VMware PowerCLI

The Best User Interface for your VMware Datacenter!

Set Video Memory on VM - Enrich PowerCLI to avoid PowerShell scriptlets

similar to https://powercli.ideas.aha.io/ideas/PCLI-I-246

Currently there are so many great cmdlets for PowerCLI but often large customers are forced to rely on API calls and Powershell scriptlets. We have to jump from cmdlets to scriptlets back and forth again and again. Please provide consistent cmdlets offered by PowerCLI without having to revert back to API calls to manage five digit VM numbers on daily basis.

Use Case:

  • change video memory

Set-VMVideoMemory -VM $servers -MemoryMB 4000 -AutoDetect $false

  • cmdlet (above) does not work any more but API:

$vid = $_.ExtensionData.Config.Hardware.Device | ?{$_.GetType().Name -eq "VirtualMachineVideoCard"}

$spec = New-Object VMware.Vim.VirtualMachineConfigSpec

$devChange = New-Object VMware.Vim.VirtualDeviceConfigSpec

$devChange.Operation = 'edit'

$vid.VideoRamSizeInKB = 4MB/1KB

$devChange.Device += $vid

$spec.DeviceChange += $devChange

$_.ExtensionData.ReconfigVM($spec)

  • Markus Struck
  • Nov 9 2020
  • Looking for Feedback
  • Attach files
  • Damon Jacobs commented
    May 13, 2021 07:03

    Thanks for your good post