LucD
Leadership
Leadership

I suspect that this method will only work when the harddisk was removed with for example the Remove-Harddisk cmdlet.

When the VMDK file was deleted from the datastore, via for example the datastore browser, you will have to check if the VMDK is still there.

Something like this

Get-Template | Select Name,@{N="HD Present";E={
    (
Get-HardDisk -Template $_ | %{
     
Get-HardDisk -DatastorePath $_.Filename -Datastore $_.FileName.Split(']')[0].TrimStart('[')}) -ne $null}}


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos