Anyone have an existing script that will only output VMs with VMDK disks not all on one datastore? This storage DRS 'keep VMDK disks together' checkbox got undone in our environment and disks were moved all over the map.
thanks
Would this help?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Thanks LucD, I started down that path but the 'get-datastore' commandlet includes mounted ISO's and not seeing a property to exempt on
came up with the below, it's ugly but seems to work
find vmx registration datastore name:
$VM = get-vm xxxx | select Name,@{N="VMPath";E={$_.ExtensionData.Config.Files.VmPathName}}
$diskreal = $VM.VMPath
$diskfinal = $diskreal.Split( )[0]
get VM harddisks and compare to vmx registration path:
get-harddisk -vm $VM.name | foreach-object {
$harddiskreal = $_.Filename
$harddiskfinal = $harddiskreal.split( )[0]
if ("$harddiskfinal" -ne "$diskfinal") {write-host $harddiskreal is on different datastore than $diskreal}
}
now to clean it up
If SDRS is active, the affinity rule should correct the situation.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference