A set of PowerShell tools for working with Hyper-V from a Windows 10 desktop. You must have the Hyper-V PowerShell module installed. This module is under active development
You can install the current release from the PowerShell Gallery:
Install-Module PSHyperVTools [-scope currentuser]
Please post any questions, problems, suggestions or comments in the Issues section of this repository.
Many of the commands in this module are "wrapper" or proxy variations of native Hyper-V cmdlets that are designed to be easier to use in an interactive PowerShell session.
When using VM groups, such as with Get-VMGroup
, the resulting object displays nested VM or Management collections. But
often, the whole point of a group is to make it easier to work with the collected virtual machines. This command will
expand all virtual machines in a given group. You can also return a simple list of the virtual machine names.
This command is very similar to Get-VMGroup
and is not much more than a "wrapper" function for that command. The
primary difference is that you can use this command to limit groups to a specific type. Although the default is to
find all VM groups.
This command is designed to get the IPv4 address for a given set of Hyper-V virtual machines. It assumes a single network adapter in each virtual machine with a single IPv4 address. The command has not been tested with other networking configurations such as NIC teaming.
This command gets memory settings for a given Hyper-V virtual machine.
One of the drawbacks to the Get-VM
command in the Hyper-V module is that it provides no filtering mechanism on the
state, such as running. If you often find yourself running Get-VM
and piping to Where-Object
to only get running or
stopped virtual machines, this command will simplify that process. The default behavior is to display all running
virtual machines.
This is a PowerShell command to make it easier to connect to a virtual machine console using the VMConnect.exe
command
line tool. You must run this under an account that has admin rights on the remote Hyper-V host.
Connect to a given virtual machine using a remote desktop connection. This assumes a Windows operating system on the virtual machine and it has been configured to allow remote desktop connections. The connection is made via the virtual machine's IP address. If connecting to a virtual machine on a remote computer it must have a publicly accessible IP address and interface.
This command will expand virtual machine members of a VM group and start the virtual machine if it is not already running.
This command will expand virtual machine members of a VM group and stop the virtual machine if it running.
This command is an alternative to using Set-VM
to modify the Notes setting of a virtual machine. This version allows you to append to an existing note or clear it.
When you import the module, it will also extend the type for a Hyper-V virtual machine and add these script properties. Some of these properties need values from the Hyper-V host. For better performance a PSSession to the Hyper-V host will be created and re-used. You might want to remove any PSSessions in your console before exiting PowerShell if you use this module.
- ManagementGroups
- Age
- TestVHD
- ConfigurationFile
- DiskPath
- Running
- SizeGB
- MemoryMB
- MemoryDemandMB
- HasSnapshot
- IPAddress
- Runtime
- VMSwitch
I have a few other commands I've built over the years that I would like to integrate into this module. Here's a taste of what I have in mind.
- Get-VHDSummary
- Get-VMLastUse
- New-HyperVStatusReport
- Show-VMMemoryPressure
- Remove-VMEntry
Last updated 2019-06-26 15:13:22Z UTC