In this article, we will look into using PowerShell in order to get some information about Hyper-V Host and VM. I’m using this to simplify on my documentation at the end of the project.
Before we begin, you need to download Powershell Management Library for Hyper-V. To download, go to http://pshyperv.codeplex.com/releases . Current latest version is R2 SP1. Well, most people don't like coding and prefer to use GUI. However, in certain way in order to get the end result faster then PowerShell is the answer.
Let look into some PowerShell command that you can use especially want to document your final result.
a) .Net Framework
b) Windows Powershell
a) Extract the zip file and execute install.cmd from command line.
To use the PowerShell, you need to import the Hyper-V Module.
Let get started:-
To know which command available, you can export the command to a text file.
|Get-command > C:\command.txt|
Some sample that might be useful:-
1. Get memory information such as dynamic memory on the entire VM
2. Get virtual cpu information that assign to the VM
3. Get network information such as network type, virtual switch and mac address assign to vm. I often use this command to identify duplicate mac address assign to the VM.
4. Get information about virtual cpu on the running vm or per vm basis.
5. Get information such as snapshot apply to the vm.
6. Get virtual switch information created on the host
That’s all for now, a simple cmdlet. Do explore on other PowerShell cmdlet that get you to another end result that you want.