VMware Cloud Community
vishal112
Contributor
Contributor
Jump to solution

Is there a Script to Install VMware tools on any Power Cycle event?

Hi All,

We currently have a 1000+ VM infrastructure spilt between 2 data-centres and are in the process of moving from ESXi 5.1 to 5.5.

What we want to ensure on the new 5.5 architecture is that any VM that did not have VMware tools installed - It gets installed on any powercycle event.

Is there a Mass script we could run for both linux and windows servers that can factor this in ?

At the moment we have 700 VM's that have tools installed and up to date

100 or so that have it installed and are not up to date

The remaining 200+ machines do not have tools installed and we want to automate them to install tools on any power cycle event.

For the 100 that are not up to date

we have followed the following tasks and confirmed that this works

vSphere Documentation Center

So any VM with out of date tools will automatically update on a  power cycle

However the 200 that need Tools installing full stop - We need some help getting a script to work / if there is one that can do this

We can use the following to update tools at power cycle

1

2

3

4

5

6

7

8

$vm = Get-VM -Name "virtualmachine"

$spec = New-Object VMware.Vim.VirtualMachineConfigSpec

$spec.changeVersion = $vm.ExtensionData.Config.ChangeVersion

$spec.tools = New-Object VMware.Vim.ToolsConfigInfo

$spec.tools.toolsUpgradePolicy = "upgradeAtPowerCycle"

$_this = Get-View -Id $vm.Id

$_this.ReconfigVM_Task($spec)

But we want something that can Install tools If not installed on Power Cycle rather than upgrade / update..

Hope that makes sense and that theres a script that we can use to do this.

Thanks all

0 Kudos
1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

The actual 1st time install of VMware Tools is afaik not possible with a PowerCLI cmdlet.

You will need to use a SW distribution method, as you would use to install any SW on your desktops.

In your case, you need to support Win and Linux VMs, so you'll need to foresee at least 2 procedures to perform the actual install.

Some further info can be found in  Re: How to Use PowerCLI Install VMware Tools ?


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

View solution in original post

0 Kudos
1 Reply
LucD
Leadership
Leadership
Jump to solution

The actual 1st time install of VMware Tools is afaik not possible with a PowerCLI cmdlet.

You will need to use a SW distribution method, as you would use to install any SW on your desktops.

In your case, you need to support Win and Linux VMs, so you'll need to foresee at least 2 procedures to perform the actual install.

Some further info can be found in  Re: How to Use PowerCLI Install VMware Tools ?


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos