Automation

 View Only
Expand all | Collapse all

Find if datastore is disconnected

  • 1.  Find if datastore is disconnected

    Posted Oct 18, 2019 07:30 AM

    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.  RE: Find if datastore is disconnected

    Posted Oct 18, 2019 08:00 AM

    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



  • 3.  RE: Find if datastore is disconnected

    Posted Oct 18, 2019 08:50 AM

    Thanks LucD