Visit VMARENA.COM For More Advanced Technical Posts , Learn More .

Monday, March 6, 2017

Script for LUN Utilization

Script for LUN Utilization 


Get-Datastore |
Select Name,
    @{N='Type';E={"$($_.Type)$($_.ExtensionData.Info.Vmfs.MajorVersion)"}},
    @{N='CapacityGB';E={[math]::Round($_.CapacityGB)}},
    @{N='FreeSpaceGB';E={[math]::Round($_.FreeSpaceGB)}},
    @{N='UsedSpaceGB';E={[math]::Round($_.CapacityGB - $_.FreeSpaceGB,1)}},
    @{N='% of LUN Utilization';E={[math]::Round(($_.CapacityGB - $_.FreeSpaceGB)/$_.CapacityGB * 100,1)}} |
Export-Csv   c:\datstoreusage.csv  -NoTypeInformation -UseCulture

No comments:

Post a Comment