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
|