How to Use WMI to Detect VMWare

Use the Windows WMI service, which runs on every Windows computer, to detect software -- including VMWare -- running on a computer. Administrators use this service to verify that software is installed on a computer; it's also a method used by administrators for software auditing. Administrators can also choose to delete or install the software from the WMI detection.

Instructions

    • 1

      Open your script file. If you do not already have a file, open Notepad to create your WMI code.

    • 2

      Instantiate the WMI instance. Instantiating the class calls the WMI class and assigns it to a variable. The following code sets up the WMI class variable:

      Set wmi = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2")

    • 3

      Run the WMI query to identify if VMWare is installed:

      Set software = objWMIService.ExecQuery ("Select * from Win32_Product Where Name = 'VMWare'")

    • 4

      Display the VMWare version, if the VMWare software is installed. The following code only displays if VMWare is installed:

      For Each app in software
      Wscript.Echo "Version: " & app.Version
      Next

Related Searches:

References

Comments

Related Ads

Featured