Some weeks ago, Microsoft have announced that they are going to shut down their TechNet Gallery very soon (that is: at the end of December, 2020). There is a small number of contributions that we have been involved with. Furtunately, the original license (MIT license) allows us to republish those contributions. So in the next days we are going to do this.
This contribution was first published in Microsoft’s TechNet Gallery. See the authors and copyright notices in the text below.
Hyper-V: Get RAM and vCPU assignments per VM and summed up
Overview
Hyper-V has a hard limit for the memory resources in the host server. You cannot assign more RAM to your running VMs than your host has as physical RAM.
The script Get-VMResourceSummary.ps1 lists all VMs on a host with their RAM and vCPU configurations. You get a list of each VM, its running state, static RAM assignment, maximum Dynamic Memory (if configured) and vCPU assignment.
Two summary tables inform you how much RAM and vCPUs your VMs need altogehter and how much of these core resources is assigned to the running VMs. That way you know quickly if your host’s resources allow for additional VMs or not.
Usage
The script does not use any parameters. Just launch it in a PowerShell window or in PowerShell ISE. Make sure to run PowerShell as an Administrator to get appropriate values.
The script queries the local computer by default. If you want to query a remote computer adjust the following line in the script code:
- original: $Hostname = $env:COMPUTERNAME
- change to: $Hostname = ‚MYSERVER‘
The script should run with Hyper-V in Windows Server 2012 and newer. It should as well run with client Hyper-V in Windows 8.1 or newer.
Download
Get-VMResourceSummary (1,9 KiB, 3.510-mal heruntergeladen, letzte Änderung am 22. Dezember 2020)
Author and Disclaimer
The script was written by Nils Kaczenski. It comes without any warranty or support. Use at your own risk. The project was initiated by the German IT service company Michael Wessel Informationstechnologie GmbH of Hannover.
Screenshot
Was <https://gallery.technet.microsoft.com/Hyper-V-Get-RAM-and-vCPU-4b29d2bb/description>
http://faq-o-matic.net/?p=8668