VMware Cloud Community
ganmetla
Contributor
Contributor

How to detect a VMware VCenter Service on a Windows machine without actually log-in to that machine?

we need to find a mechanism by which we can reliably and accurately detect (in an agent-less mode) whether the VMware VCenter Service is running on the Windows Machine without actually log-in to that Windows machine.

   Can you please suggest us how to reliably detect whether VCenter service is available on a Windows Machine or not?

0 Kudos
1 Reply
spravtek
Expert
Expert

I think the easiest solution will be using some script like this vbscript:

OPTION EXPLICIT

DIM strComputer,strServiceName
strComputer = "." ' Local Computer
strServiceName = "wuauserv" ' Windows Update Service

IF isServiceRunning(strComputer,strServiceName) THEN
     wscript.echo "The '" & strServiceName & "' service is running on '" & strcomputer & "'"
ELSE
     wscript.echo "The '" & strServiceName & "' service is NOT running on '" & strcomputer & "'"
END IF

' Function to check if a service is running on a given computer
FUNCTION isServiceRunning(strComputer,strServiceName)
     DIM objWMIService, strWMIQuery

     strWMIQuery = "Select * from Win32_Service Where Name = '" & strServiceName & "' and state='Running'"

     SET objWMIService = GETOBJECT("winmgmts:" _
          & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")

     IF objWMIService.ExecQuery(strWMIQuery).Count > 0 THEN
          isServiceRunning = TRUE
     ELSE
          isServiceRunning = FALSE
     END IF

END FUNCTION

You'll need to adjust it for checking remotely, but besides that it should do the trick ... Just use the vCenter service name in as the string to look for. With some manipulation you could feed it a list of computers to check as well.

Forgot the source of the script: http://www.wisesoft.co.uk/scripts/vbscript_check_if_service_is_running.aspx

0 Kudos