5 Replies Latest reply on Apr 14, 2009 8:39 AM by timcwhite

    VMtools Status Help

    timcwhite Enthusiast

       

      Good morning,

       

       

      I've set up an alarm within Virtual Center that monitors the Vmtools status (Heartbeat Alarm)of each VM. When the tools stop, it sends me an alarm, then runs a script to restart the tools. The alarm piece works but the script doesn't. The sad thing is that I use to have this running until I upgraded our environment. I can't figure out what I am going wrong. I tried adding the On Error Resume Next statement. I didn't get any errors after adding that statement but it still didn't work. Thanks for looking at this with me. Below is the script:

       

       

       

       

       

      Set objSWbemLocator = CreateObject("WBemScripting.SWbemLocator")

       

       

      set objWMIService = objSWbemLocator.ConnectServer (Wscript.Arguments(0), "root\cimv2", "Domain\username", 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

       

       

       

       

       

      Here are the errors that I am getting;

       

       

      I loaded the script on a VM directly just to test it.

       

       

      When I run c:\scripts>restarttools.vbs I get the following error: Runtime error: Subscript out of range

       

       

      When I use c:\scripts>restarttools.vbs {tagetname},  I get the following error: Runtime error: Subscript out of range

       

       

      When I use c:\scripts>restarttools.vbs {tagetname} password,  I get the following error: SWbemlocator: User Connections can't be used for local connections

       

       

       

       

       

      Can anyone help me? Thanks

       

       

      Tim