VMware Tools Status report

Script to create a report about the VMware Tools status:

Sample Output:

Total VMs: 527
Total powered on: 474
Total powered off: 53
ToolsOK: 140
ToolsOld: 227
ToolsNotInstalled: 106
DisConnect from Virtual Center

Set-PSDebug -Strict
$VIServer = "VCENTERIP"
Connect-VIServer -server $VIServer -User USERNAME -Password PASSWORD

$vms = Get-VM | Sort Name
$on = 0
$toolsOk = 0
$toolsOld = 0
$toolsNotInstalled = 0
foreach ($vm in $vms){
	if ($vm.PowerState -like "PoweredOn"){
		$vmview = $vm | Get-View
		$toolsstatus = $vmview.Guest.ToolsStatus
		$toolsrunningstatus = $vmview.Guest.ToolsRunningStatus
		$toolsversionstatus = $vmview.Guest.ToolsVersionStatus
		$on = $on+1
		if ($toolsstatus -like "toolsOk"){
			$toolsOk = $toolsOk + 1
		}
		if ($toolsstatus -like "toolsOld"){
			$toolsOld = $toolsOld + 1
		}
		if ($toolsstatus -like "toolsNotInstalled"){
			$toolsNotInstalled = $toolsNotInstalled + 1
		}
	}
}
$count = $vms.Count
$off = $count - $on
Write-Host "Total VMs: $count" 
Write-Host "Total powered on: $on"
Write-Host "Total powered off: $off"
Write-Host "ToolsOK: $toolsOk"
Write-Host "ToolsOld: $toolsOld"
Write-Host "ToolsNotInstalled: $toolsNotInstalled"
# DisConnect to Virtual Center
Write-Host "DisConnect from Virtual Center"
Disconnect-VIServer -Server $VIServer -Confirm:$False

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.