Vmware Tools Status_PowerShell Script

After learning PowerShell, this is my first script!

Save the below contents in a notepad file and save it as .ps1 extn.

$vcenter = read-host “Please enter the vCenter name”
Write-Host “Connecting to vCenter Server”
Connect-VIServer $vcenter
Get-VM | where {$_.Guest.OSFullName -like “*Windows*”} | Sort Name | `
Select     @{N=”VMName”; E={$_.Name}},
@{N=”HardwareVersion”; E={$_.Extensiondata.Config.Version}},
@{N=”ToolsVersion”; E={$_.Extensiondata.Config.Tools.ToolsVersion}},
@{N=”ToolsStatus”; E={$_.Extensiondata.Summary.Guest.ToolsStatus}},
@{N=”ToolsVersionStatus”; E={$_.Extensiondata.Summary.Guest.ToolsVersionStatus}},
@{N=”ToolsRunningStatus”; E={$_.Extensiondata.Summary.Guest.ToolsRunningStatus}},
@{N=”Cluster”; E={(Get-Cluster -VM $_.Name).Name}},
@{N=”ESX Host”; E={$_.Host.Name}},
@{N=”ESX Version”; E={$_.Host.Version}},
@{N=”ESX Build”; E={$_.Host.Build}} | Export-Csv “C:\Tools.csv” -NoTypeInformation

Disconnect-VIServer $vcenter -Confirm:$false


*The script queries Windows VM’s only but you can always edit the script as per your requirements

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 )

Google photo

You are commenting using your Google 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 )

Connecting to %s