Created
May 29, 2018 17:17
-
-
Save gowatana/a452a1dbef30db9ac0103b170df34ed2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$vm_names = $args[0] | |
$vms = Get-VM $vm_names | |
$vms | % { | |
$vm = $_ | |
$guest = $vm.Guest | |
$guest.Disks | select ` | |
@{N="VM";E={$vm.Name}}, | |
Path, | |
@{N="CapacityGB";E={"{0:0.0}" -f $_.CapacityGB}}, | |
@{N="FreeSpaceGB";E={"{0:0.0}" -f $_.FreeSpaceGB}}, | |
@{N="UsagePCT";E={ | |
$usage_pct = 100 - ($_.FreeSpaceGB / $_.CapacityGB * 100) | |
"{0:0.0}" -f $usage_pct}} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
下記の投稿むけ。
PowerCLI で ゲスト OS のファイルシステム使用量を確認してみる。
https://communities.vmware.com/people/gowatana/blog/2018/05/29/powercli-guest-disk-usage