When you set the memory of a HyperV machine to something lower than the original range it fails.
This commit is contained in:
parent
dbf603b136
commit
10181f7c8a
|
@ -36,7 +36,7 @@ $generation = $vmConfig.VM.Generation
|
||||||
if (!$vmname) {
|
if (!$vmname) {
|
||||||
# Get the name of the vm
|
# Get the name of the vm
|
||||||
$vm_name = $vmconfig.VM.VMName
|
$vm_name = $vmconfig.VM.VMName
|
||||||
}else {
|
} else {
|
||||||
$vm_name = $vmname
|
$vm_name = $vmname
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -86,15 +86,18 @@ if (!$switchname) {
|
||||||
$switchname = (Get-VMNetworkAdapter -VM $vmConfig.VM).SwitchName
|
$switchname = (Get-VMNetworkAdapter -VM $vmConfig.VM).SwitchName
|
||||||
}
|
}
|
||||||
|
|
||||||
Connect-VMNetworkAdapter -VMNetworkAdapter (Get-VMNetworkAdapter -VM $vmConfig.VM) -SwitchName $switchname
|
$vmNetworkAdapter = Get-VMNetworkAdapter -VM $vmConfig.VM
|
||||||
Set-VM -VM $vmConfig.VM -NewVMName $vm_name -MemoryStartupBytes $MemoryStartupBytes
|
Connect-VMNetworkAdapter -VMNetworkAdapter $vmNetworkAdapter -SwitchName $switchname
|
||||||
Set-VM -VM $vmConfig.VM -ErrorAction "Stop" -ProcessorCount $processors
|
Set-VM -VM $vmConfig.VM -NewVMName $vm_name
|
||||||
|
Set-VM -VM $vmConfig.VM -ErrorAction "Stop"
|
||||||
|
Set-VM -VM $vmConfig.VM -ProcessorCount $processors
|
||||||
|
|
||||||
If ($dynamicmemory) {
|
if ($dynamicmemory) {
|
||||||
Set-VM -VM $vmConfig.VM -DynamicMemory
|
Set-VM -VM $vmConfig.VM -DynamicMemory
|
||||||
Set-VM -VM $vmConfig.VM -MemoryMinimumBytes $MemoryMinimumBytes -MemoryMaximumBytes $MemoryMaximumBytes
|
Set-VM -VM $vmConfig.VM -MemoryMinimumBytes $MemoryMinimumBytes -MemoryMaximumBytes $MemoryMaximumBytes -MemoryStartupBytes $MemoryStartupBytes
|
||||||
} else {
|
} else {
|
||||||
Set-VM -VM $vmConfig.VM -StaticMemory
|
Set-VM -VM $vmConfig.VM -StaticMemory
|
||||||
|
Set-VM -VM $vmConfig.VM -MemoryStartupBytes $MemoryStartupBytes
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($notes) {
|
if ($notes) {
|
||||||
|
|
Loading…
Reference in New Issue