Hello
I'm trying to recreate an alawrm that I hade setup previous within virtual center that would monitor a Virtual machines heartbeat. I had a script that would restart the VMtools service on a windows box when the alarm went off. Below is the script:
+Set objSWbemLocator = CreateObject("WBemScripting.SWbemLocator") +
+set objWMIService = objSWbemLocator.ConnectServer (Wscript.Arguments(0), "root\cimv2", "domain\useraccount", Wscript.Arguments(1)) +
+*Set colServices = objWMIService.ExecQuery ("Select * from Win32_Service Where Name = 'vmtools'")* +
+For Each objService in colServices +
+errReturnCode = objService.StopService() +
Next
+Wscript.Sleep 20000 +
+For Each objService in colServices +
+errReturnCode = objService.StartService() +
Next
The command that I would run is: cscript.exe c:\scripts\restarttools.vbs password
When i run the script on a local machine I receive the following error:
SWbemlocator: User credentials cannot be used for local connections
Can anyone help me with this? I need to get this working as some of my backups are failing because Virtual Center shows the Tools Status as being Down
Thanks in advance