VMware Cloud Community
meistermn
Expert
Expert

How to install VMware tools without a reboot?

On the following url the a script for updating vmware tools. What is the parameter for no reboot?

It must be in line 48 . Is the command update-tools by vmware with all there switches described?

0 Kudos
79 Replies
LucD
Leadership
Leadership

That script is indeed for PowerShell but you need to know that you can use 2 types of objects.

First there are the objects from the VITK, their name mostly ends with Impl, and then there are the objects from the SDK.

Have a look at for further details on this.

The Get-View cmdlet allows you to go from the VITK objects to the SDK objects.

And that is what jp1960's script does with the "...Get-View $_.ID..." cmdlet (on line 4).

This is required since the UpgradeTools_Task method is only available on the SDK object.

Are you sure you aren't missing that part.

I'll include the script for completeness


$insParm = '/s /v"/qn /norestart"'
$updList = get-cluster -name <clustername> | get-vm | `
where-object {$_.powerstate -eq "PoweredON"} | % {
	get-view $_.ID} |where {$_.guest.toolsstatus -match "toolsOld" } | where {$_.guest.guestfamily -match "windowsGuest"}
{
	$uVM.name
	$uVM.UpgradeTools_Task($insParm)
}


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

0 Kudos
sunchaser
Contributor
Contributor

Thank you for this explanation! indeed i have missed that part because I don't want to look for old tools (..and thought I don't need this :smileylaugh: )

0 Kudos
padesjar
Contributor
Contributor

I have not done this with PowerShell yet, but this is how I do it via shell script on the Windows VMs. VMwareToolsUpgrader just get the tools distribution and passes the rest of the arguments after -p to Setup.exe. You can see that arguments are then passed to msiexec using the /v switch. Not sure if adding /v"/qn /norestar" will help you in this case or not.

"C:\Program Files\VMware\VMware Tools\VMwareToolsUpgrader.exe" -p "/s /v\"/qn /norestart /L*v C:\Windows\Temp\ToolsUpgrade.log\""

I would recommend using something like Process Monitor or Process

Explorer to see what is actually running on the VM when you run your

code (in PM you can filter on vmwaretoolsupgrader.exe, setup.exe, and msiexec.exe). This is how I managed to get a working command string like above. Snapshots are clearly a good thing in this situation so you can repeat the same actions.

Thanks, this worked well for me. I don't have time for installing powershell on every machine. It's good stuff, don't get me wrong, and I'm sure a windows update would install it fine on all machines, but this is more native and worked great for me. Now I can set up a chron on this and have it run periodically to keep my VMs up to date and ready for update manager to do its thing as well. Thanks!

0 Kudos
RobMokkink
Expert
Expert

@Luc,

I am testing the script, i wan't replace it with our current way of updating the vmware tools (SCCM)

However the script still reboots the vm's

0 Kudos
LucD
Leadership
Leadership

Out of curiosity, to which tools version are you upgrading ?

To VC2.5u4 ?


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

0 Kudos
RobMokkink
Expert
Expert

Thats correct luc. I wan to upgrade from tools version 110268 (in windows 3.1.2.5.692) to tools version 143128 (in windows 3.1.2.9374)

0 Kudos
RobMokkink
Expert
Expert

I think i got it working, i tested it 2 times, here is the code:

</p></p>
<p><p>#ADD VMWARE PSSNAPIN<br/><br/>
Add-PSSnapin -Name "VMware.VimAutomation.Core"</p></p>
<p><p>#FORCE TO LOAD VMWARE POWERSHELL PLUGIN<br/><br/>
[void][http://Reflection.Assembly|http://Reflection.Assembly]::LoadWithPartialName("vmware.vim")</p></p>
<p><p>#ON ERROR CONTINUE<br/><br/>
$ErrorActionPreference = "Continue"</p></p>
<p><p>#VARIABLES<br/><br/>
$vm = "&lt;name of vm&gt;"<br/><br/>
$VCSERVER = "localhost"<br/><br/>
$INSPARAM = '/S /v"/qn REBOOT=ReallySuppress"'</p></p>
<p><p>#CONNECT TO THE ESX HOST<br/><br/>
connect-viserver $VCSERVER</p></p>
<p><p>$GETVM = get-vm $vm | get-view<br/><br/>
$GETVM.Name<br/><br/>
$GETVM.UpgradeTools_Task($INSPARAM)</p></p>
<p><p>

</p>

So if other people can test, that wil be great.

0 Kudos
RobMokkink
Expert
Expert

sorry that doesn't work as well is i thought, it takes some time before the server reboots.

0 Kudos
dconvery
Champion
Champion

Hey LucD -

WIll this work for *nix VMs as well? DO I just need to change the parameters to "-" instead of "/"?

Dave Convery

VMware vExpert 2009

Careful. We don't want to learn from this.

Bill Watterson, "Calvin and Hobbes"

Dave Convery, VCDX-DCV #20 ** http://www.tech-tap.com ** http://twitter.com/dconvery ** "Careful. We don't want to learn from this." -Bill Watterson, "Calvin and Hobbes"
0 Kudos
LucD
Leadership
Leadership

I'm afraid not.

If I'm not mistaken for *nix VMs the Tools are installed with rpm. So other parameters.

In our experience we noticed that on *nix guests the NICs tend to loose their connection during/after a Tools upgrade.

Update : if someone knows how to avoid this please let us know!

We're using RHES 4 & 5 and some Suse.


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

0 Kudos
dconvery
Champion
Champion

That's what I thought. Thanks.

I have seen the NIC drop during upgrade on Windows guests as well.

Dave Convery

VMware vExpert 2009

Careful. We don't want to learn from this.

Bill Watterson, "Calvin and Hobbes"

Dave Convery, VCDX-DCV #20 ** http://www.tech-tap.com ** http://twitter.com/dconvery ** "Careful. We don't want to learn from this." -Bill Watterson, "Calvin and Hobbes"
0 Kudos
Gpeto
Contributor
Contributor

Hi,

I'm looking for any way to make a scheduled VM massive reboot.

Anybody knows any script to make this easily? I haven't find anything about that.

Thanks.

0 Kudos
PhilippNoack
Contributor
Contributor

Hello, I used a little workaround for that. Here is the batch script that I used:

:: Creating a temp folder to get the newest tools

md C:\vmwaretools-update\

set TMP=C:\vmwaretools-update\

C:

cd "C:\Programme\VMware\VMware Tools\"

:: Running the Upgrader with a wrong parameter to get the newest Version only! It doesn't update, yet!

start "" /wait VMwareToolsUpgrader.exe -p "/s /v\"/qn /noreboot\""

cd C:\vmwaretools-update\00*

:: Now the actual update begins

start "" /wait setup.exe /s /v"/qn REBOOT=ReallySuppress"

C:

set TMP="C:\Dokumente und Einstellungen\Administrator\Lokale Einstellungen\Temp\"

rd C:\vmwaretools-update\

exit

I hope it helps you!

Greetings Phil

0 Kudos
AlexLudwig
Contributor
Contributor

Non of these worked on my side. At least I used this one as a batch script. At the End you´ll have a logfile where you can see which server is patched, which not and which one is unreachable.

************************************************************************************

REM In the srv.txt enter a list of all serversr / export em out of the VC

set log=C:\logfile.txt

for /f %%i in (C:\srv.txt) do call :PingMe %%i

:PingMe

REM If you have another language on your system change the word "Reply" wich you receive on a ping

ping -n 1 -w 40 %1 | find "Reply" &gt;nul || goto :Offline

if errorlevel 0 goto :Online

:Online

echo "%1"

echo Now installing...

REM After -p you have to write the password of the User , that´s the only problem. If you don´t do so u have to type in your password for every server

psexec %1 -u USER -p Password
SHARE\setup.exe /S /v"/qn /norestart REBOOT=ReallySuppress REINSTALL=ALL REINSTALLMODE=VOMUS"

REM You need to copy all the files in the share you normally get if you map the CD for VMWare Tools over the VC

IF %errorlevel%==0 goto good

:bad

echo "Not successful on
%1" &gt;&gt;%log%

goto End

:good

echo "Successful on
%1" &gt;&gt;%log%

goto End

goto End

:Offline

echo "
%1 is offline" &gt;&gt; %log%

goto End

:End

*******************************************************************************

I patched at least for about 180 Servers within 1 hour.... Smiley Wink

0 Kudos
beeswarm
Contributor
Contributor

Hi all,

I have done a quick article on this topic on my blog.

http://www.mycloudcake.com/vmware/install-vmware-tools-no-immediate-reboot/

Hope this helps.

Cheers

0 Kudos
meistermn
Expert
Expert

Here is an other idea for PowerCLI Update VMware Tools without a reboot.

0 Kudos
meistermn
Expert
Expert

Update Manager vSphere

Powershell

CMD + PSEXEC

vmrun command

upgrade on power on vm

VM's must be power on

yes, if power off , the vm is powered on, and vmware tools upgraded

yes

yes

yes

no, must be powered off and then powered on

Upgrade VMware Tools

yes

yes

yes

yes

Install Vmware Tools

no

yes

yes

yes

Disadvantage Copy Vmware tools

no

no

yes, VMware Tools have to be copied to the vm's, because network disconnection appears , wehn vmare tools are instaled

set Hardware accelation automatic

no

yes

yes

?

0 Kudos
meistermn
Expert
Expert

The last part in the following script is not work.ing The cdrom is mounted , but th execution of setup.exe is to short and breaks. the script is directly started from vc-server.

#----


  1. Set up variables

#----


#VM Server hostname

$VMServer = "vc-server"

#User account to connect to virtual infrastructure:

$username = "vc-user"

#Directory path to target list of VM's.

$servers = Get-Content "e:\serverlist.txt"

Write-Host "Serverlist:" $servers

#----


  1. Connect to VM Server

#----


  1. $server = Connect-VIServer -Server $VMServer -User $username

$server = Connect-VIServer -Server $VMServer

#Search for specific VM in the production cluster:

$cluster = Get-Cluster -Name "Cluster-DRS-AMD 2_ESX3i"

Write-Host "Var cluster:" $cluster

#----


  1. Main()

#----


foreach ($svr in $servers)

{

$result = gwmi -class Win32_PingStatus -filter "Address='$svr'"

Write-Host "Var result:" $result

$results = $result.StatusCode

Write-Host "Var resultsstatuscode:" $results

$vm = Get-VM -Name $svr -Location $cluster #Search for specified VM in cluster

Write-Host "Var VM:" $vm

#If the VM is powered on, but guest OS is not responding to pings

$vm.PowerState -eq "PoweredOn"

Write-Host "Var PowerState:" $vm.PowerState

if (($vm.PowerState -eq "PoweredOn") -and ($results -eq 0))

{

  1. Mount the tools CD

$vmImpl = Get-VM $vm

Write-Host "Var vmImpl:" $vmImpl

  1. Get the VirtualMachine SDK object

$vmmmmmm = $vmImpl | Get-View

Write-Host "Var vmmmmmm :" $vmmmmmm

  1. Call the SDK method

$vmmmmmm.MountToolsInstaller()

  1. Get the drive letter for the CD Drive tools is mounted in

$DrvLetter = Get-WmiObject Win32_CDROMDrive -ComputerName $VM.name | Where-Object {$_.VolumeName -match "VMware Tools"}

Write-Host "Var DrvLetter :" $DrvLetter.Drive

$cmd ="$($DrvLetter.Drive)setup.exe /S /v`"/qn REBOOT=ReallySuppress REINSTALLMODE=vamus REINSTALL=ALL`""

Write-Host "Vari cmd :" $cmd

("
$vm\ROOT\CIMV2:win32_process").Create("cmd.exe /c $cmd")

#("
$vm\ROOT\CIMV2:win32_process").Create("cmd.exe /c notepad.exe")

#$c = "Win32_Process"

#$c.create("cmd.exe /c notepad.exe")

}

}

0 Kudos
meistermn
Expert
Expert

There seems to be a difference between a update installation and an New install

Update installation

"<Pfad-zu-Exe>\setup.exe" /S /v"INSTALLDIR=C:\APPS\VMWARE\Tools

REINSTALLMODE=vamus REINSTALL=ALL

TRANSFORMS=1033.mst REBOOT=REALLYSUPPRESS /qn"

New installation

"<Pfad-zu-Exe>\setup.exe" /S /v"INSTALLDIR=C:\APPS\VMWARE\Tools

ADDLOCAL=ALL

TRANSFORMS=1033.mst REBOOT=REALLYSUPPRESS /qn"

0 Kudos
halr9000
Commander
Commander

This thread is incredibly long. Can someone summarize for those who haven't read all four pages and all the attached links--is there a good solution for installing the tools without a reboot, using PowerShell?






[vExpert|http://www.vmware.com/communities/vexpert/], PowerShell MVP, VI Toolkit forum moderator

Author of the book: Managing VMware Infrastructure with PowerShell

Co-Host, PowerScripting Podcast (http://powerscripting.net)

Need general, non-VMware-related PowerShell Help? Try the forums at PowerShellCommunity.org

My signature used to be pretty, but then the forum software broked it. vExpert. Microsoft MVP (Windows PowerShell). Author, Podcaster, Speaker. I'm @halr9000
0 Kudos