This page looks best with JavaScript enabled

Quick VM Report with PowerCLI

 ·  β˜• 1 min read  ·  ✍️ Brett Johnson

I primarily use this PowerCLI script after performing VM migrations. The script output focuses on what changed during the migration. Specifically moving to hosts running a newer version of ESXi.

The script is simple to modify and adapt to fit your specific needs.

Using the Script

To make use of the script, all that you need to do is set the $ClusterName and $Path values at the beginning. However,Β think of this not as a β€˜run as it is’; script. Consider, this to be a framework.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
 
$ClusterName = β€œENTER CLUSTER NAME”
$Path = β€œEnter CSV Output path”


get-cluster $ClusterName | Get-VM |
Select Name,
@{N="Host"; E={$_.vmhost}},
@{N="Datastore";E={[string]::Join(',',(Get-Datastore -Id $_.DatastoreIdList | Select -ExpandProperty Name))}},
@{N="Folder";E={$_.Folder.Name}},
@{N="Hardware";E={$_.version}},
@{N="ToolsStatus";E={$_.ExtensionData.Guest.ToolsStatus}},
@{N="ToolsVersion";E={$_.ExtensionData.Guest.ToolsVersion}} |
Export-Csv $Path
Share on

Brett Johnson
WRITTEN BY
Brett Johnson
Automator of things