一、 列出Hyper-V PowerShell命令行模块

在搜索中PowerShell并打开PowerShell

get-command –module hyper-v | out-gridview

使用get-help帮助学习Hyper-V PowerShell

使用Hyper-V PowerShell

二、 使用PowerShell列出虚拟机

使用下面的命令列出正在运行的虚拟机

get-vm | where {$_.State –eq ‘Running’}

使用下面的命令列出已经关闭的虚拟机

get-vm | where {$_.State –eq ‘Off’}

三、 使用PowerShell创建虚拟机

使用管理员身份打开Windows PowerShell ISE

使用下面的命令创建虚拟机

$VMName = "Client01"
$VM = @{
    Name = $VMName
    MemoryStartupBytes = 2147483648
    Generation = 2
    NewVHDPath = " D:\Hyper-V\$VMName\$VMName.vhdx"
    NewVHDSizeBytes = 53687091200
    BootDevice = "VHD"
    Path = " D:\Hyper-V\$VMName "
    SwitchName = (get-vmswitch).Name[0]
}

New-VM @VM

使用Hyper-V PowerShell

更多Hyper-V PowerShell cmdlet部分请参见微软官方网站:

https://technet.microsoft.com/%5Clibrary/Hh848559.aspx

转载于:https://blog.51cto.com/ericxuting/1722991

相关文章:

  • 2021-04-24
  • 2021-05-20
  • 2021-12-04
  • 2021-10-24
  • 2021-05-16
  • 2021-04-02
  • 2021-10-27
猜你喜欢
  • 2022-01-08
  • 2021-04-22
  • 2021-04-13
  • 2022-01-21
  • 2022-12-23
  • 2021-07-03
相关资源
相似解决方案