GuilhermeStela
Enthusiast
Enthusiast

Install/Upgrade VMwareTools with PowerCLI

Jump to solution

Could anyone give a light here? Install/Upgrade VMwareTools by using PowerCLI....

1 Solution

Accepted Solutions
aerodevil
Hot Shot
Hot Shot

PowerCLI has a great cmdlet called Update-Tools and even allows you to upgrade the tools without rebooting.

Get-VM | Update-Tools -NoReboot

http://www.vmware.com/support/developer/PowerCLI/PowerCLI501/html/Update-Tools.html

Josh Atwell @Josh_Atwell http://www.vtesseract.com http://github.com/joshatwell/

View solution in original post

0 Kudos
8 Replies
Chrisxxxx
Contributor
Contributor

Get-Help is your fried.  :smileygrin:

$> help tools

Name                              Category  Synopsis
----                              --------  --------
Wait-Tools                        Cmdlet    Waits for the VMware Tools of the specified virtual machines to load.
Dismount-Tools                    Cmdlet    Dismounts the VMware Tools installer CD.
Mount-Tools                       Cmdlet    Mounts the VMware Tools CD installer as a CD-ROM on the guest operating system.
Update-Tools                      Cmdlet    Upgrades the VMware Tools on the specified virtual machine guest OS.

GuilhermeStela
Enthusiast
Enthusiast

[vSphere PowerCLI] C:\Program Files\VMware\Infrastructure\vSphere PowerCLI\Scrip
ts> get-vm MV0715* | mount-tools
Mount-Tools : 3/30/2012 5:26:29 PM    Mount-Tools        Operation "Mount VMwar
e Tools." failed for VM "MV0715-DBRILLER" for the following reason: This virtua
l machine does not have a CD-ROM drive configured. A virtual machine must have
a CD-ROM drive configured for this option to work.

At line:1 char:28
+ get-vm MV0715* | mount-tools <<<<
[vSphere PowerCLI] C:\Program Files\VMware\Infrastructure\vSphere PowerCLI\Scrip
ts> get-vm MV0715* | New-CDDrive
New-CDDrive : 3/30/2012 5:30:00 PM    New-CDDrive        The VM must be in the
following state: PoweredOff.
At line:1 char:28
+ get-vm MV0715* | New-CDDrive <<<<

It's possible to Mount VMware Tools or add New CD Drive with the VM powered ON?

:smileyplain:

0 Kudos
Chrisxxxx
Contributor
Contributor

There is, but I don't know off the top of my head if it will work with a powered on VM.

mce_markergt; help cddrive
Name                              Category  Synopsis
----                              --------  --------
Get-CDDrive                       Cmdlet    Retrieves virtual CD drives.
New-CDDrive                       Cmdlet    Creates a new virtual CD drive.
Remove-CDDrive                    Cmdlet    Removes virtual CD drives from their locations.
Set-CDDrive                       Cmdlet    Changes the configuration of a virtual CD drive.

Note: Get-CDDrive only shows drives with mounted CDs or ISOs.  Use this to see if a CD drive is defined for the VM: "get-vm  MV0715* | select cddrives".

For upgrading the tools on a VM that already has the tools installed all you should need to use is the "Update-Tools" cmdlet.  You shouldn't need "Mount-Tools".

After doing a little searching I realized there isn't an equivalent easy command to do an initial install of the tools through PowerCLI.   This link has a method that might seem easy or complicated depending on your background in software install automation.  Smiley Happy  http://communities.vmware.com/thread/281802    If that doesn't work for you then you'll just have to open the console on each VM and from the menu bar select "VM --> Guest --> Install/Upgrade VM Tools".

hth

0 Kudos
VladL
Enthusiast
Enthusiast

Hi, I would use the following approach, in breaf :

1. Extract VMwareTools tar file :

     * Prepare for quick update (required one time for fresh tools tar extraction) :

     a. Mount VMware tools into some VM (with CDDrive) : Right-click VM -> Guest -> Install / Upgrade VMware Tools

     b. If Linux : Ssh VM -> mount /dev/cdrom /tmp/some_dir otherwise just browse the CD.

     c. Copy to /some_path/VMwareTools-X.X.X-XXXXXX.tar.gz

2. For each VM -> copy the tar ball with "Copy-VMGuestFile"

3. Update each VM  by : using Invoke-VMScript for tar extract into temp dir

and additional command execute  "/path_to_extracted_dir/vmware-tools-distrib/vmware-install.pl  [-d]"

* Or even better, if you have some nfs export mounted in VMs -> one time extract of tar to the shared dir. and use for each VM only one Invoke-VMScript for vmware-install.pl execution.

Good luck.

GuilhermeStela
Enthusiast
Enthusiast

Someone have any alternative?

0 Kudos
aerodevil
Hot Shot
Hot Shot

PowerCLI has a great cmdlet called Update-Tools and even allows you to upgrade the tools without rebooting.

Get-VM | Update-Tools -NoReboot

http://www.vmware.com/support/developer/PowerCLI/PowerCLI501/html/Update-Tools.html

Josh Atwell @Josh_Atwell http://www.vtesseract.com http://github.com/joshatwell/

View solution in original post

0 Kudos
GuilhermeStela
Enthusiast
Enthusiast

just perfect . . . it works exactly the way i need.

thank you so much!!!!

0 Kudos
escapem2
Enthusiast
Enthusiast

hi guys

someone knows a way to install Vmware Tools for the first time using power cli?

thanks