Book Image

Microsoft Hyper-V PowerShell Automation

By : Vinith Menon
Book Image

Microsoft Hyper-V PowerShell Automation

By: Vinith Menon

Overview of this book

Table of Contents (13 chapters)
Microsoft Hyper-V PowerShell Automation
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Configuring properties on virtual machines


Configuring properties on virtual machines can be done using PowerShell cmdlets that have the Set verb in them. To get a list of all the PowerShell cmdlets that can be used to set a virtual machine's properties, type command shown in the following screenshot, in the PowerShell prompt:

As you can see in the preceding screenshot, there are a number of properties that can be set for the virtual machine, including the BIOS, DVD drive, virtual machine memory, and also network adapter properties. Also, there is a Set-VMHost cmdlet that allows you to set some of the properties related to the Hyper-V host. Let's go through these cmdlets one by one.

Type the following cmdlet in the PowerShell prompt to change the automatic stop action of all the VMs running on both nodes of the Hyper-V cluster:

Get-ClusterNode | select @{l='ComputerName';e={$_.name}} | % {Get-VM -ComputerName $_.computername | Set-VM -AutomaticStopAction shutdown }

Note

The VMs need to be in...