I have a Hyper-V machine with virtual machines running on it. Recently I tried some PowerShell scripts on it. The script is
Get-Vm | sort Name |
select Name, Uptime, @{N="MemoryMB";E={$_.MemoryAssigned/1MB}},
ProcessorCount, Status, @{N="MemoryMaxMB";E={$_.MemoryMaximum/1MB}}
I have doubts on few of the fields. When I am comparing it with machines I guess MemoryAssigned
is the RAM of the machine where as is there any way by which I can get RAM allocated for turned off machines and also the Hard Disk details of each?
There is no Memory allocated to a Virtual Machine that is not running.
Get-Vm brings back a Selected.Microsoft.HyperV.PowerShell.VirtualMachine
object.
If you use Get-Member
as suggested by Ansgar Wiechers, you will see a property called HardDrives which has some information about your hard disks. one of which is the path which we can use:
(Get-VM).HardDrives | foreach {Get-Vhd -Path $_.Path}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.