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: 

Show WWN of FC devices

First you need to connect to a vCenter:

Connect-VIServer -Server VCENTERIP -User USERNAME -Password PASSWORD

Get-VMHost | Sort | Select Name,
     @{N="FC Device";E={[string]::Join(",",(($_ | Get-View).Config.StorageDevice.HostBusAdapter | where{$_.GetType().Name -eq "HostFibreChannelHba"} | %{$_.Device}))}},
     @{N="FC WWN";E={[string]::Join(",",(($_ | Get-View).Config.StorageDevice.HostBusAdapter | where{$_.GetType().Name -eq "HostFibreChannelHba"} | %{"{0:x}" -f $_.NodeWorldWideName}))}}

Disconnect-VIServer -Server VCENTERIP -Force -Confirm:$false

Get VM information as Script node for the Virtualization EcoShell

This script node will open a small window with a drop down menu with all your VM’s listed. Select one and click on OK. The script will collect some information and then display them.

Script node:

if ($global:defaultviservers) {
	#Generated Form Function
	function GenerateForm {
	########################################################################
	# Code Generated By: SAPIEN Technologies PrimalForms (Community Edition) v1.0.7.0
	# Generated On: 25/11/2009 12:55
	# Generated By: IT2000
	########################################################################
	
	#region Import the Assemblies
	[reflection.assembly]::loadwithpartialname("System.Windows.Forms") | Out-Null
	[reflection.assembly]::loadwithpartialname("System.Drawing") | Out-Null
	#endregion
	
	#region Generated Form Objects
	$form1 = New-Object System.Windows.Forms.Form
	$button1 = New-Object System.Windows.Forms.Button
	$label1 = New-Object System.Windows.Forms.Label
	$comboBox1 = New-Object System.Windows.Forms.ComboBox
	$InitialFormWindowState = New-Object System.Windows.Forms.FormWindowState
	#endregion Generated Form Objects
	
	#----------------------------------------------
	#Generated Event Script Blocks
	#----------------------------------------------
	#Provide Custom Code for events specified in PrimalForms.
	$button1_OnClick= 
	{
	$global:Cluster = $comboBox1.SelectedItem
	$form1.close()
	}
	
	$handler_label2_Click= 
	{
	#TODO: Place custom script here
	
	}
	
	$OnLoadForm_StateCorrection=
	{#Correct the initial state of the form to prevent the .Net maximized form issue
		$form1.WindowState