What are the minimum permissions a user would need to remotely restart a
service using vbs?

Of course everything works great if the user is a local administrator on the
remote machine, but that would go outside the parameters of the task.

I have given the user power user membership as well as full rights to the
Root namespace and all subnamespaces on the remote machine ... but with no
luck.

The remote machine is a Windows 2000 Server SP3

The funny thing is that power user rights allows remote connection and
service restart using "Computer Management" console, but once again this
falls out of the tasks parameters for a one button remote service restart.

Here is the script I wrote for the task

strComputer = "MyServer"
strService = "MyService"
Set objWMIService = GetObject("winmgmts:" &
"{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
CheckErr "Connect to " & strComputer
Set colRunningServices = objWMIService.ExecQuery ("Select * from
Win32_Service where Name='" & strService & "'")
For Each objService in colRunningServices
objService.StopService()
CheckErr "Stop " & strService & " Service"
objService.StartService()
CheckErr "Start " & strService & " Service"
Wscript.quit 1
Next
Wscript.echo "Could not connect to the " & strService & " on " & strComputer

Function CheckErr(strDesc)
If Err.Number <> 0 Then
strMessage = "Script failed to " & strDesc & " 0x" & Hex(Err.Number)
If(Len(Err.Description) > 0) Then
strMessage = strMessage & chr(13) & "Err.Description: " &
Err.Description
End If
wscript.echo strMessage & chr(13) & date & " at " & time
Else
wscript.echo strDesc & " successful
End If
End Function

Any help is greatly appreciated

TIA

Charles

Re: remote permissions by Charles

Charles
Sat Feb 19 22:08:13 CST 2005

Nevermind ... the WMI service was just taking a long time to process the new
permissions.

A restart of the WMI service applies the new permissions at that time.

Also, I trimmed back the users WMI permissions to just the Root and CIMV2
namespaces with Remote Enable.

Charles

"Charles Blair" <charles_blair@hotmail.com> wrote in message
news:OlgIkwvFFHA.3728@TK2MSFTNGP14.phx.gbl...
> What are the minimum permissions a user would need to remotely restart a
> service using vbs?
>
> Of course everything works great if the user is a local administrator on
the
> remote machine, but that would go outside the parameters of the task.
>
> I have given the user power user membership as well as full rights to the
> Root namespace and all subnamespaces on the remote machine ... but with no
> luck.
>
> The remote machine is a Windows 2000 Server SP3
>
> The funny thing is that power user rights allows remote connection and
> service restart using "Computer Management" console, but once again this
> falls out of the tasks parameters for a one button remote service restart.
>
> Here is the script I wrote for the task
>
> strComputer = "MyServer"
> strService = "MyService"
> Set objWMIService = GetObject("winmgmts:" &
> "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
> CheckErr "Connect to " & strComputer
> Set colRunningServices = objWMIService.ExecQuery ("Select * from
> Win32_Service where Name='" & strService & "'")
> For Each objService in colRunningServices
> objService.StopService()
> CheckErr "Stop " & strService & " Service"
> objService.StartService()
> CheckErr "Start " & strService & " Service"
> Wscript.quit 1
> Next
> Wscript.echo "Could not connect to the " & strService & " on " &
strComputer
>
> Function CheckErr(strDesc)
> If Err.Number <> 0 Then
> strMessage = "Script failed to " & strDesc & " 0x" & Hex(Err.Number)
> If(Len(Err.Description) > 0) Then
> strMessage = strMessage & chr(13) & "Err.Description: " &
> Err.Description
> End If
> wscript.echo strMessage & chr(13) & date & " at " & time
> Else
> wscript.echo strDesc & " successful
> End If
> End Function
>
> Any help is greatly appreciated
>
> TIA
>
> Charles
>
>