I have a service that I need to script to set a user name and password for.
When opening it is says something about the device associated with it does not exist.
When scripting to change the user name and password, it returns error 21, device not ready ( I think ).
How can I get around this and change the user name and password?
Here is a snippit... ( I am wrapping it in an HTA, hence the document.writeln stuff...)
When opening it is says something about the device associated with it does not exist.
When scripting to change the user name and password, it returns error 21, device not ready ( I think ).
How can I get around this and change the user name and password?
Here is a snippit... ( I am wrapping it in an HTA, hence the document.writeln stuff...)
Code:
Set colServiceList = objWMIService.ExecQuery("Select * from Win32_Service where Name='WksCfgSrv'")
For Each objService in colServiceList
stoperror = objService.StopService()
'((Sleep code here ))
objdocument.writeln("<br>Stop error was " & stoperror & "<br>")
r = objService.Change( , , , , , , serviceUser, servicePass)
objdocument.writeln(objservice.name & "<br>")
if r = 0 then
msg = msg & "<br>Updated logon for " & objService.Name & " ok"
else
objdocument.writeln("<br><br>Error level is " & r)
objdocument.writeln("<br>" & err.description)
msg = msg & "<br>ERROR: could not update logon for " & objService.Name
End If