July 4, 2025

USEFUL-IT

A blog for USEFUL-IT information

VM-Info

How to retrieve information of virtual machine that is running on a Hyper-V host by using PowerShell. <a href=""> Read More...

How to retrieve information of virtual machine that is running on a Hyper-V host by using PowerShell.

Get-VM -ComputerName VM1,VM2 | Select Computername,Name,State,`
        @{l="Gen";e={$_.Generation}},`
        CreationTime,`
        #@{l="Created";e={"{0:dd.MM.yyyy}" -f $_.CreationTime}},`
        @{l="Uptime";e={$_.uptime}},`
        #@{l="Uptime";e={"$($_.uptime.days)d$($_.uptime.hours)h$($_.uptime.minutes)m$($_.uptime.seconds)s"}},`
        #@{l="Uptime1";e={"{0:00d}/{1:00h}:{2:00m}.{3:00s}" -f $($_.uptime.days),$($_.uptime.hours),$($_.uptime.minutes),$($_.uptime.seconds)}},`
        @{l="CPUs";e={$_.ProcessorCount}},`
        @{l="MemoryMB";e={($_.memoryassigned/1MB)}},`
        @{l="MemoryMin";e={$_.MemoryMinimum/1MB}},`
        @{l="MemoryMax";e={$_.MemoryMaximum/1MB}},`
        @{l="MacAddress";e={$_.networkadapters.macaddress}} | FT -AutoSize

This is only a n example please feel free to adjust it to your own needs.

About The Author