Updating the vmx configuration on multiple virtual machines
search cancel

Updating the vmx configuration on multiple virtual machines

book

Article ID: 306344

calendar_today

Updated On:

Products

VMware vSphere ESXi

Issue/Introduction

This article provides a PowerCLI script to update the vmx configuration on multiple virtual machines with these parameters:
"isolation.tools.copy.disable"="true";
"isolation.tools.paste.disable"="true";
"isolation.tools.diskShrink.disable"="true";
"isolation.tools.diskWiper.disable"="true";
"isolation.tools.connectable.disable"="true";
"isolation.tools.setGUIOptions.Enable"="false";
"log.keepOld"="10";
"log.rotateSize"="100000"


Resolution

This PowerCLI script updates the vmx configuration on multiple virtual machines:

Note: This script is available here for reference only.

$ExtraOptions = @{
"isolation.tools.copy.disable"="true";
"isolation.tools.paste.disable"="true";
"isolation.tools.diskShrink.disable"="true";
"isolation.tools.diskWiper.disable"="true";
"isolation.tools.connectable.disable"="true";
"isolation.tools.setGUIOptions.Enable"="false";
"log.keepOld"="10";
"log.rotateSize"="100000"
}

# Build the configspec using the hashtable above.
$vmConfigSpec = New-Object VMware.Vim.VirtualMachineConfigSpec

Foreach ($Option in $ExtraOptions.GetEnumerator()) {
$OptionValue = New-Object VMware.Vim.optionvalue
$OptionValue.Key = $Option.Key
$OptionValue.Value = $Option.Value
$vmConfigSpec.extraconfig += $OptionValue
}

# Get all vm's not including templates
$VMs = Get-View -ViewType VirtualMachine -Property Name -Filter @{"Config.Template"="false"}

# Do it!
foreach($vm in $vms){
$vm.ReconfigVM_Task($vmConfigSpec)
}


Additional Information

For more information on the vSphere PowerCLI, see Using the vSphere PowerCLI utility to manage your vSphere environment (2032946).

To be alerted when this article is published, click Subscribe to Document in the Actions box.