PowerShell: Check VMware Tools Status


To ensure the VMware Tools is running or not out of date, we have to periodically check it.

image

The following PowerShell script can generate a VMware Tools status report in csv format.

image

#Uncomment if this SnapIn has not been added
#Add-PSSnapIn VMware.VimAutomation.Core

CLS

$creds = Get-VICredentialStoreItem -file “C:\powercli\credfile.xml”
Connect-viserver -Server $creds.Host -User $creds.User -Password $creds.Password

Get-VM | Get-View | Select-Object @{N=”VM Name”;E={$_.Name}},@{Name=”VMware Tools”;E={$_.Guest.ToolsStatus}} | Export-CSV c:\powercli\VMwareToolsStatus.csv

How to generate the credential file

Use the following script to update the VMware Tools without a reboot. (Keep all the VM that need to be updated in the VM.txt)

Get-Content C:\powercli\VMs.txt | ForEach-Object { Update-Tools -VM $_ -NoReboot }

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s