Forum Discussion
zmmj123
May 12, 2021Copper Contributor
Check the hyper-v vm's Maximum disk size
Hi all, In vm's setup, in SCSI controller, in virtual hard disk, and click "inspect" botten, I can see the "Maximum disk size". Now I want to use powershell commandlet to check this value, please hel...
SteveMacNZ
May 17, 2021Iron Contributor
You can also expand this out to list for all VHDX files under a given location as well using this script, which will give you the VHDName FileSize and MaxSize
$vhds = Get-ChildItem -path C:\Hyper-V\ -filter *.vhdx -Recurse | Select-Object Name, Directory
$results =@()
ForEach ($vhd in $vhds){
$vpath = "$($vhd.Directory)" + "\" + "$($VHD.Name)"
$results += Get-VHD -Path $vpath | Select-Object @{Name="VHDName";Expression={$_.Path.split("\")[-1]}} , @{Name="FileSize_GB";Expression={$_.FileSize/1GB}} , @{Name="MaxSizeGB";Expression={$_.Size/1GB}}
}
$results | Format-Table
zmmj123
May 17, 2021Copper Contributor
Many thanks for your help, I can use powershell comlet get the value now.