Some time ago I already created a script to report the disk alignment status of your Windows VM’s. I updated the script so you are able to export it to a CSV or XML file.
$myCol = @() $vms = get-vm | where {$_.PowerState -eq "PoweredOn" -and ` $_.Guest.OSFullName -match "Microsoft Windows*" } | Sort Name foreach($vm in $vms){ $wmi = get-wmiobject -class "Win32_DiskPartition" ` -namespace "root\CIMV2" -ComputerName $vm foreach ($objItem in $wmi){ $Details = "" | Select-Object VMName, Partition, Status if ($objItem.StartingOffset -eq "65536"){ $Details.VMName = $objItem.SystemName $Details.Partition = $objItem.Name $Details.Status = "Partition aligned" } else{ $Details.VMName = $objItem.SystemName $Details.Partition = $objItem.Name $Details.Status = "Partition NOT aligned" } $myCol += $Details } } $myCol | Export-Csv -NoTypeInformation "C:\Temp\PartitionAlignment.csv" #$myCol | Export-Clixml "C:\Temp\PartitionAlignment.xml"
The script uses WMI to gather the information about the partition of the Windows VM. So if you’re using a Firewall, be sure to open the right ports. More info about WMI and Firewalls, can be found over here: http://msdn.microsoft.com/en-us/library/aa822854%28VS.85%29.aspx
The output will look like this: