VMware Cloud Community
antoniogemelli
Hot Shot
Hot Shot

Find if datastore is disconnected

Hello,

I have some VM in some hosts where datastore is disconnected from the hosts,

This VM show the disks but provisioned and used space are 0

I would like to identify these vm with host and datastore name (with UUID)

I used this as base to and then I filtered directly in CSV, but I would like to use something better,

Get-VM | Select Name, PowerState, Version, NumCpu, MemoryGB,

    @{N = 'UsedSpaceGB'; E = { [math]::Round($_.UsedSpaceGB, 1) } },

    @{N = 'ProvisionedSpaceGB'; E = { [math]::Round($_.ProvisionedSpaceGB, 1) } } |

Export-Csv -Path C:\Users\gemela\Desktop\powerstate_report.csv -NoTypeInformation -UseCulture

Thanks  for support

2 Replies
LucD
Leadership
Leadership

You could use a where-clause to filter.

Get-VM |

where{$_.ProvisionedSpaceGB -eq 0 -and $_.UsedSpaceGB -eq 0} |

Select Name, PowerState, Version, NumCpu, MemoryGB,

    @{N = 'UsedSpaceGB'; E = { [math]::Round($_.UsedSpaceGB, 1) } },

    @{N = 'ProvisionedSpaceGB'; E = { [math]::Round($_.ProvisionedSpaceGB, 1) } } |

Export-Csv -Path C:\Users\gemela\Desktop\powerstate_report.csv -NoTypeInformation -UseCulture


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

antoniogemelli
Hot Shot
Hot Shot

Thanks LucD

Reply
0 Kudos