Applies to: VMware vSphere and a compatible PowerCLI release. The example uses a planned powered-off change.
Before you start
- Confirm the VM name is unique, the target memory is approved and host capacity is available.
- Agree downtime, check the backup and close applications cleanly. Memory hot-add has separate guest and VM requirements.
Procedure
- Connect to the intended vCenter and select exactly one VM.
- Shut down the guest through its normal operating-system process. The example deliberately stops if the VM is still running.
- Apply the approved memory size, read back the result and start the VM only when the change plan calls for it.
Single-VM PowerCLI example
Connect-VIServer -Server 'vcenter.example.com'
$vm = Get-VM -Name 'Example-VM' -ErrorAction Stop
if (@($vm).Count -ne 1) { throw 'Select exactly one VM.' }
if ($vm.PowerState -ne 'PoweredOff') {
throw 'Shut down the guest cleanly, then run this example again.'
}
Set-VM -VM $vm -MemoryGB 8 -Confirm:$true -ErrorAction Stop
Get-VM -Id $vm.Id | Select-Object Name, MemoryGB, PowerState
# Start-VM -VM $vm -Confirm:$true # Only if the change plan requires it.Check the result
- Check the guest sees the new memory and application services are healthy.
- Record the final power state and actual allocation.