一、 列出Hyper-V PowerShell命令行模块
1
|
get-command
–module hyper-v |
out-gridview
|
1
|
get-vm
| where {
$_
.State –eq ‘Running’}
|
1
|
get-vm
| where {
$_
.State –eq ‘Off’}
|
1
2
3
4
5
6
7
8
9
10
11
12
13
|
$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
|