chinnashara
Technical User
Hi All,
I tried to get a script which bounces the services on a machine.
The script seems to be working fine on a local machine..but when i try to stop the services on a remote machiens am getting the below error...
Error: Permission Denied: 'GetObject'
Code:800A0046.
Below is the script which i used...
strService = "ERsvc"
strComputer = "WISBLRDP071"
WScript.Echo "Restarting " & strService & "..."
' Stop dependent services
Set objWMI = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set objServiceList = objWMI.ExecQuery("Associators of " _
& "{Win32_Service.Name='" & strService & "'} Where " _
& "AssocClass=Win32_DependentService " & "Role=Antecedent" )
For Each objService In objServiceList
WScript.Echo " Stopping " & objService.Name
objService.StopService()
Next
Please can some one help me
I tried to get a script which bounces the services on a machine.
The script seems to be working fine on a local machine..but when i try to stop the services on a remote machiens am getting the below error...
Error: Permission Denied: 'GetObject'
Code:800A0046.
Below is the script which i used...
strService = "ERsvc"
strComputer = "WISBLRDP071"
WScript.Echo "Restarting " & strService & "..."
' Stop dependent services
Set objWMI = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set objServiceList = objWMI.ExecQuery("Associators of " _
& "{Win32_Service.Name='" & strService & "'} Where " _
& "AssocClass=Win32_DependentService " & "Role=Antecedent" )
For Each objService In objServiceList
WScript.Echo " Stopping " & objService.Name
objService.StopService()
Next
Please can some one help me