VMware PowerCLI Function to Modify Virtual Machine Configuration Options

This is a blog post I did on a different blog and I am am migrating most of the VMware/system admin posts here and this is the first.

I was looking for a powershell script to set a few virtual machine security options for a school lab. The configuration keys I need to set are isolation.device.connectable.disable, isolation.device.edit.disable, and RemoteDisplay.maxConnections.

I found a function used to set RemoteDisplay.maxConnections here. By changing the RemoteDisplay.maxConnections it could be used to also change the other options so I modified the function to accept another parameter for the setting you want to add or change.

Here is the function:

Function Set-ExtraOptions{
    $vmConfigSpec = New-Object VMware.Vim.VirtualMachineConfigSpec

    $extra = New-Object VMware.Vim.optionvalue
    $vmConfigSpec.extraconfig += $extra

        $vm = Get-VM $vmName | Get-View

And here is how you call it:

Set-ExtraOptions -vmName VM_NAME -KeyName KEY_NAME -KeyValue KEY_VALUE

To set isolation.device.connectable.disable to FALSE for LabVM-A just call the function like this:

Set-ExtraOptions -vmName “LabVM-A” -KeyName isolation.device.connectable.disable -KeyValue FALSE


Hersey Cartwright is an IT professional with extensive experience designing, implementing, managing, and supporting technologies that improve business processes. Hersey is Solutions Architect for HPE SimpliVity covering Virginia, Washington DC, and Maryland. He holds the VMware Certified Design Expert (VCDX-DV #128) certification. Hersey actively participates in the VMware community and was awarded the VMware vExpert title in 2016, 2015, 2014, 2013, and 2012. He enjoys working with, teaching, and writing about virtualization and other data center technologies. Follow Hersey on Twitter @herseyc

2 thoughts on “VMware PowerCLI Function to Modify Virtual Machine Configuration Options

Leave a Reply

Your email address will not be published. Required fields are marked *