xybal
Enthusiast
Enthusiast

automate vmware tools upgrade / installation

Hi,

I've found this on a post on communities to automate vmware tools upgrade / install:

$installerArgs = 'REBOOT="ReallySuppress"'

Get-VM | % { (Get-View $_).UpgradeTools_Task($installerArgs) }

Variable initialisation happens witout any Pb, but when I copy the second line (with a VM name following Get-VM of course) it give me this :

C:\> Get-VM GQN00549 | % { (Get-View $_).UpgradeTools_Task($i

nstallerArgs) }

Get-View : 27/05/2010 15:59:19 Get-View Invalid object specified for

parameter Id - 'VirtualMachineImpl'. Valid types are ManagedObjectReference and

string.

At line:1 char:32

+ Get-VM GQN00549 | % { (Get-View <<<< $_).UpgradeTools_Task($installerArgs) }

+ CategoryInfo : InvalidArgument: (GQN00549:VirtualMachineImpl) [

Get-View], VimException

+ FullyQualifiedErrorId : Core_GetVIView_TryGetIdParam_InvalidValue,VMware

.VimAutomation.Commands.DotNetInterop.GetVIView

You cannot call a method on a null-valued expression.

At line:1 char:54

+ Get-VM GQN00549 | % { (Get-View $_).UpgradeTools_Task <<<< ($installerArgs) }

+ CategoryInfo : InvalidOperation: (UpgradeTools_Task:String) [],

RuntimeException

+ FullyQualifiedErrorId : InvokeMethodOnNull

I'm a newbie on powerCLI so is someone can debug this for me please ?

Thx

Reply
0 Kudos
RvdNieuwendijk
Leadership
Leadership

Try:

$installerArgs = 'REBOOT="ReallySuppress"'
(Get-VM | Get-View).UpgradeTools_Task($installerArgs)

Regards Robert

Blog: https://rvdnieuwendijk.com/ | Twitter: @rvdnieuwendijk | Author of: https://www.packtpub.com/virtualization-and-cloud/learning-powercli-second-edition

View solution in original post

Reply
0 Kudos
xybal
Enthusiast
Enthusiast

Is there a way to Install Instead Upgrading ?

After Upgrade, my vmware tools are still "out of date" are the needed a reboot ?

Thx very much

Reply
0 Kudos
xybal
Enthusiast
Enthusiast

I tested a reboot on a VM after launching these command lines.

Nothing more happens, my vmwaretools are still out of date.

Is someone know what to do to achieve correctly the installation and finaly obtain this "OK".

Thx

Reply
0 Kudos