tonySchlein
asked on
Non Administrator to stop and start service.
I want to use the following script to stop and start a service on a remote machine.
Administrators can successfully run it but non-administrators cannot.
Is there a way to modify the script to allow non-administrators to run the script?
Set objWMIService = GetObject("winmgmts:{" & _
"impersonationLevel=impers onate}!\\r emoteserve r\root\cim v2")
Set colListOfServices = objWMIService.ExecQuery("S elect * from Win32_Service")
' WMI and VBScript loop
For Each objService in colListOfServices
If ucase(objService.name)="TA RGETSERVIC E" Then
objService.StopService()
WSCript.Sleep 15000
objService.StartService()
End If
Next
Administrators can successfully run it but non-administrators cannot.
Is there a way to modify the script to allow non-administrators to run the script?
Set objWMIService = GetObject("winmgmts:{" & _
"impersonationLevel=impers
Set colListOfServices = objWMIService.ExecQuery("S
' WMI and VBScript loop
For Each objService in colListOfServices
If ucase(objService.name)="TA
objService.StopService()
WSCript.Sleep 15000
objService.StartService()
End If
Next
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
http://www.rivernorthsoftware.com/startstop/features.aspx