Hi All,
Is there any script where i can upgrade multiple VMs VMtools ,
like i will show the VM names in text file and VMtools exe file in a location.
Thanks in Advance.
VMtools.exe?
What do you mean by that?
Do these VMs have guest managed VMware Tools?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Does this not work for you?
$vmNames = Get-Content -Path C:\Temp\vmNames.txt
Get-VM -Name $vmNames | Update-Tools -NoReboot -RunAsync
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
This are Windows server and running with 10.0 version, i want to upgrade them to 10.3 later version.
instead of VM Edit settings-> Guest->Install VM tools and loggin each server and running the mounted tools.
i have latest VMtools exe file.. or any script which can pick this exe or else..anyother option VMs get updated with latest vmtools.
The code I shared will not require you to logon to each server.
Did you try it?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
do i need to mount the ISO (edit VM setting, Guest- install VMtools)?
No, normally not.
The Update-Tools cmdlet takes care of that.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Hi LuCD,
its not working. i ran the script but nothing seems to be happening on VM. even i tried to do reboot.. still it has same older VMtools versoin.
$vmNames = Get-Content -Path C:\Temp\vmNames.txt
Get-VM -Name $vmNames | Update-Tools -NoReboot -RunAsync
am getting output like this. but nothing seems to be happening in VM OS.
Name | State | % Complete Start Time Finish Time |
---- | ----- | ---------- ---------- ----------- |
UpgradeTools_Task | Running | 0 07:21:29 PM |
Do these VMs already have the VMware Tools installed?
Are they Guest Managed versions?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
yes, these VMs have alreday VMware tools running.
i want to upgrade them from 10.2.5.8068406 version to 10.3 version.
And my 2nd question was "Are they Guest Manager tools?"
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
LuCD thanks for your response..
am confused when you say "Guest Manager tools"..
it is just VMtools installed on those Vms.
On several OS, mostly Linux, the VMware Tools come as part of the OS.
This is indicated in the Web Client.
To upgrade those tools, you will need to use the upgrade features of the guest OS.
Another type of Guest Managed VMware Tools, is when you installed the EXE yourself.
And not through the ISO that comes in vSphere.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
mine is all VMs are Windows. when i see on webclient i get like this.
That one says version 11, and that it is current.
Did you test on one that says "Upgrade available"?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
LucD, I know this is an old post, but I hope you can help me.
I changed your script slightly and it runs, however, I am trying to add some new 'features'
$vmNames = Import-CSV -Path C:\Temp\vmNames.txt
Get-VM -Name $vmNames.'VM Name' | Update-Tools -NoReboot -RunAsync
1. I really like the way it displays the task and % complete on the screen, but how to I create a loop that runs until the last machine in the list is at 100% and can I easily output this file?
2. I have about 800 servers to update and I only want to send 10 servers at a time to be updated. What would be the most efficient way/code to get this done?
Thanks!
Are you sure you see a progress bar with the RunAsync switch?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
It's not really a progress bar, just information displayed in the Command Screen in Powershell ISE
Ok, that is the same info you can get with Get-Task.
In fact, you have to use Get-Task, in a loop, till none of the tasks shows "Running" anymore.
Similar when you want to impose a maximum number of background tasks.
With Get-Task you can see how many background tasks are running, and wait if that is equal or more than your desired maximum.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
LucD, I have another error that I hope you can help with. The following code works to change the flag to upgradeAtPowerCycle, but it throws an error at the end of the script execution:
<# This will change the Local VM Policy to Update VMTools upon the next reboot#>
$spec = New-Object VMware.Vim.VirtualMachineConfigSpec
$spec.tools = New-Object VMware.Vim.ToolsConfigInfo
$spec.tools.ToolsUpgradePolicy = "upgradeAtPowerCycle"
$VMs = Import-CSv C:\Temp\MyFile.csv
foreach ($VM in $VMs) {
$VM = Get-VM $VM.VMName | where{$_.Guest.OSFullName -match 'Windows' -and $_.PowerState -eq 'PoweredOn'}
$VM.ExtensionData.ReconfigVM($spec)
}
This produces the following error:
You cannot call a method on a null-valued expression.
At line:7 char:1
+ $VM.ExtensionData.ReconfigVM($spec)
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : InvokeMethodOnNull