Hi,
I'm not the best scripter so i am looking for some advice on how to list all windows servers in a folder/cluster. My goal is to exclude updating the vmtools on my linux servers in any folder specified and on the windows servers i want to suppress a restart.
So far i have this
get-folder "Updates" |get-vm | Update-Tools -NoReboot
So what do i need to add to return just the windows servers? Any help is greatly appreciated
You can select to update the VMware tools on only the Windows guests in folder Updates with:
Get-Folder "Updates" | Get-VM | Where-Object {$_.Guest.OSFullName -like "*Windows*"} | Update-Tools -NoReboot
Regards, Robert
You can select to update the VMware tools on only the Windows guests in folder Updates with:
Get-Folder "Updates" | Get-VM | Where-Object {$_.Guest.OSFullName -like "*Windows*"} | Update-Tools -NoReboot
Regards, Robert
Points awarded, for information and responsiveness.....
any advice on how to check which version of VMtools in running and then upgrade only these VM's.
You can use an extra condition in the where-clause.
Get-Folder "Updates" | Get-VM | `
Where-Object {$_.Guest.OSFullName -like "*Windows*" -and ($_ | Get-View).Summary.Guest.ToolsStatus -eq "toolsOld"} | `
Update-Tools -NoReboot
____________
Blog: LucD notes
Twitter: lucd22
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Thanks LucD, this is great.
Where can i go / what can i read to understand more about the options that can be used with these conditions. I can get my head around the very basic commands but as soon as i need to add some options i get lost.
For the PowerCLI (and PowerShell) cmdlets, you can always do a Get-Help like
Get-Help Get-VM Get-Help Get-VM -Full
For the managed objects (which you can access via the Get-View cmdlet), you can search in the VMware vSphere API Reference Documentation. But that is not an easy subject !
Study existing scripts and try to understand what is used.
There is also a lot of information in this Community.
And there are several blogs (including mine) where you can read up on using the SDK properties and methods.
____________
Blog: LucD notes
Twitter: lucd22
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
How would I modify this script to:
1. Generate a report of all Windows VM's with out of Date VMware Tools per Cluster, send to csv file?
2. Update VMware Tools per Cluster without rebooting
Thanks you
