Skip to content

Instantly share code, notes, and snippets.

@gowatana
Created May 29, 2018 17:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gowatana/a452a1dbef30db9ac0103b170df34ed2 to your computer and use it in GitHub Desktop.
Save gowatana/a452a1dbef30db9ac0103b170df34ed2 to your computer and use it in GitHub Desktop.
$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}}
}
@gowatana
Copy link
Author

下記の投稿むけ。

PowerCLI で ゲスト OS のファイルシステム使用量を確認してみる。
https://communities.vmware.com/people/gowatana/blog/2018/05/29/powercli-guest-disk-usage

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment