You can use the Set-VMResourceConfiguration cmdlet to modify the resource configuration properties of a virtual machine, including memory, CPU shares, and other settings.
Prerequisites
Verify that you are connected
to a
vCenter
Server
system.
Procedure
- View the resource configuration for the VM1 virtual machine.
Get-VMResourceConfiguration -VM VM1
- View the disk share of the VM1 virtual machine.
Get-VMResourceConfiguration -VM VM1 | Format-Custom -Property DiskResourceConfiguration
- Change the memory share of the VM1 virtual machine to low.
Get-VM VM1 | Get-VMResourceConfiguration | Set-VMResourceConfiguration -MemSharesLevel low
- Change the CPU shares of the VM1 virtual machine to high.
Get-VM VM1 | Get-VMResourceConfiguration | Set-VMResourceConfiguration -CpuSharesLevel high
- Change the disk share of the VM1 virtual machine to 100.
$vm1 = Get-VM VM1
$vm1disk = Get-HardDisk $vm1
Get-VMResourceConfiguration $vm1 | Set-VMResourceConfiguration -Disk $vm1disk -DiskSharesLevel custom -NumDiskShares 100