I. List of hyper-V PowerShell command-line modules
In the search for PowerShell and open PowerShell
Get-command–module Hyper-V | Out-gridview
Use Get-help to help you learn hyper-V PowerShell
650) this.width=650; "height=" 141 "title=" clip_image004 "style=" margin:0px;border:0px;padding-top:0px; Padding-right:0px;padding-left:0px;background-image:none, "alt=" clip_image004 "src=" http://s3.51cto.com/wyfs02/ M01/77/d1/wkiom1zuun7swg1gaaciryzkvqs652.jpg "border=" 0 "/>
Ii. using PowerShell to list virtual machines
Use the following command to list the virtual machines that are running
GET-VM | where {$_. State–eq ' Running '}
Use the following command to list the virtual machines that have been shut down
GET-VM | where {$_. State–eq ' Off '}
Iii. creating a virtual machine using PowerShell
Open windows PowerShell ISE with an administrator
Use the following command to create a virtual machine
$VMName = "Client01" $VM = @{Name = $VMName Memorystartupbytes = 2147483648 Generation = 2 Newvhdpath = "d:\h Yper-v\ $VMName \ $VMName. vhdx "newvhdsizebytes = 53687091200 BootDevice =" VHD "Path =" D:\Hyper-V\ $VMName "Sw Itchname = (get-vmswitch). NAME[0]}NEW-VM @VM
650) this.width=650; "height=" 803 "title=" clip_image009 "style=" border:0px;padding-top:0px;padding-right:0px; Padding-left:0px;background-image:none, "alt=" clip_image009 "src=" http://s3.51cto.com/wyfs02/M02/77/D0/ Wkiol1zuupcr_vcwaak3wrysbca463.png "border=" 0 "/>
For more information on the Hyper-V PowerShell cmdlet section, see Microsoft Official website:
Https://technet.microsoft.com/%5Clibrary/Hh848559.aspx
This article is from "Xu Ting blog-it technology sharing" blog, please be sure to keep this source http://ericxuting.blog.51cto.com/8995534/1722991
Using Hyper-V PowerShell