Hi Everyone,
I have the following script to upgrade VMWare Tools without a reboot.
update-Tools -VM VNNx -Noreboot
However, I need to only update 200 (UAT) VMWare guests instead of my full prod environment.
can I use this script, and reference a text file to determine which guests I want to upgrade.
Or another script that would allow me to use a text file of VMGuests that I only wnat to ugrade.
Thanks for your help
If you make a text file VMs.txt with on every line the name of a VM that you want to update, you can update the VMware Tools of all those VM's with:
Get-Content -Path VMs.txt | ` ForEach-Object { Update-Tools -VM $_ -NoReboot }
Regards, Robert
If you make a text file VMs.txt with on every line the name of a VM that you want to update, you can update the VMware Tools of all those VM's with:
Get-Content -Path VMs.txt | ` ForEach-Object { Update-Tools -VM $_ -NoReboot }
Regards, Robert
Thank Robert,
works like a charm
I know this is an old post, but I seem to be having troubles. I am extremely new to powershell, so forgive me.
My code is nearly the same, minus the obvious. I am throwing an couple terminator errors. What am I missing?
Error message received:
The string starting:
At C:\VM\test.ps1:1 char 30
+ Get-Content -C:\VM\VMs.txt | <<<< '
is missing the terminator: '.
At C:\VM\text.ps1:2 char:48
+ForEach-Object [Update-tools -VM $_} <<<<
+CategoryInfo : ParserError: (
Foreach-Objec...M $_}:String) [], ParseException
+ Fully QualifiedErrorId : TerminatorExpectedAtEndOfString
Any help would be great, thanks!
The last character in the first line needs to be the back tick ` instead of the single quote '.
The minus sign before the path should not be there.
Get-Content C:\VM\VMs.txt | `
ForEach-Object {Update-Tools -VM $_}Regards, Robert