PowerCLI: Change VMware Tools Options


image

In this post you will learn how to change the VMware Tools settings in the Options menu which you can find in the vSphere Client:

image

You can enable or disable these features via the following PowerCLI script:

$vCenter = Read-Host "Enter vCenter Server name"

Connect-VIServer $vCenter

$vmConfigSpec = New-Object VMware.Vim.VirtualMachineConfigSpec
$vmConfigSpec.Tools = New-Object VMware.Vim.ToolsConfigInfo
$vmConfigSpec.Tools.AfterPowerOn = $true
$vmConfigSpec.Tools.AfterResume = $true
$vmConfigSpec.Tools.BeforeGuestStandby = $true
$vmConfigSpec.Tools.BeforeGuestShutdown = $true
$vmConfigSpec.Tools.SyncTimeWithHost = $true
$vmConfigSpec.Tools.ToolsUpgradePolicy = "Manual" # "UpgradeAtPowerCycle"

Get-VM | % { (Get-View $_.ID).ReconfigVM($vmConfigSpec)}

Disconnect-VIServer -Confirm:$false

 

Just change the $true values to $false if you want to disable the feature. If you want to change the Tools Upgrade Policy to Upgrade at startup just remove "Manual" # and it should change the Policy.

This is what you see when the VM is still active:

image image

This script will change the configured settings on All the VM’s.  If you want to change the settings on a particular VM just change Get-VM into Get-VM vmname

Advertisements

4 thoughts on “PowerCLI: Change VMware Tools Options

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s