VMware Cloud Community
COS
Expert
Expert

VBScript to get the version of VMware Tools version on VM's....

Does anyone have an easy way via vbscript to get the version of VMware Tools that's installed on a VM?

I need to install the VMCI\VShield option of VMware tools on all the VM's in the farm.

I have already written the script that enumerates the VM's CPU Architecture of either "X86" or "AMD64" and that determines which executable of setup.exe or setup64.exe to run.

Why do I need to know this? Because some VM's reside in a cluster where the hosts are either 5.5 or 5.1 or 5.0 and I am pretty sure the VMware tools are different. Getting the tools version will let me know which version of the tools setup to execute.

Someone correct me if I'm wrong here.

Why VBScript and not powershell? Because we have a lot of 2003 Servers and the Admins for the 2008 and 2012 don't setup powershell for a remotesigned.

VBScript will run native with no problem and hopefully I can get past the dang requirement of "Run as Administrator".

Thanks

Reply
0 Kudos
5 Replies
a_p_
Leadership
Leadership

The attached script may not be exactly what you asked for, but you should be able to copy the part you need. Btw. you can install the latest tool on all the VMs, see VMware Product Interoperability Matrix

André

COS
Expert
Expert

OK, figured it out. Here's the script just in case someone needs it....

Set objFSO = CreateObject("Scripting.FileSystemObject")

Set objTextFile = objFSO.CreateTextFile("c:\software-WMI.tsv", True)

'strComputer = "."

strComputer = InPutBox("Please key in the machine name.",vbQuestion,"MachineName")

Set objWMIService = GetObject("winmgmts:" _

& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")

Set colSoftware = objWMIService.ExecQuery _

("Select * from Win32_Product Where Description='VMware Tools'")

objTextFile.WriteLine "Caption" & vbtab & _

"Description" & vbtab & "Identifying Number" & vbtab & _

"Install Location" & vbtab & _

"Install State" & vbtab & "Name" & vbtab & _

"Package Cache" & vbtab & "SKU Number" & vbtab & "Vendor" & vbtab _

& "Version"

For Each objSoftware in colSoftware

objTextFile.WriteLine objSoftware.Caption & vbtab & _

objSoftware.Description & vbtab & _

objSoftware.IdentifyingNumber & vbtab & _

objSoftware.InstallLocation & vbtab & _

objSoftware.InstallState & vbtab & _

objSoftware.Name & vbtab & _

objSoftware.PackageCache & vbtab & _

objSoftware.SKUNumber & vbtab & _

Replace(objSoftware.Vendor,vbtab,"_") & vbtab & _

objSoftware.Version

Next

objTextFile.Close

Set Set objFSO = Nothing

Set objWMIService = Nothing

MsgBox "Done" & vbcrlf & "Saved in c:\software-WMI.tsv"

Reply
0 Kudos
COS
Expert
Expert

So if i'm hearing you correctly, The tools from the esx with 5.5 will run fine on a vm on an esx host that either 5.0 or 5.1?

Thanks

Reply
0 Kudos
a_p_
Leadership
Leadership

Yes, according to the Interop Matrix, the latest VMware Tools are supported on ESX 4.0 and newer.

Btw. unless I'm mistaken you can also start setup.exe for 32 as well as 64 bit guests, and the installation procedure should install the appropriate components automatically.

André

Reply
0 Kudos
COS
Expert
Expert

Correction. My script seems to only work when run locally on a server and remotely only if WMI is installed and running on the 2003 servers......which it is not. I need to remotely enumerate the list of applications installed on a set of servers that doesn't have WMI.

Thanks

Reply
0 Kudos