Powershell
Check kb on VM's
#Add-PSSnapIn VMware.VimAutomation.Core # Connect to vCenter $VC = Connect-VIServer (Read-Host "Enter vCenter server") # Enter the KB# $HotFixID = (Read-Host "Enter KB#") Write-Host # Get all VM�s with powerstate = PoweredOn $VMS = Get-VM | Where {$_.PowerState -eq "PoweredOn"} | Sort Name ForEach ($VM in $VMS) { # Process only Windows Server VM�s if ($VM.Guest.OSFullName -match "Microsoft Windows Server*") { # Get all the info using WMI $results = get-wmiobject -class "Win32_QuickFixEngineering" -namespace "root\CIMV2" -ComputerName $VM # Loop through $results and look for a match then output to screen foreach ($objItem in $results) { # Do the match if ($objItem.HotFixID -match $HotFixID) { write-host $objItem.CSName write-host "Hotfix "$HotFixID" installed" write-host } } } } # Disconnect from vCenter Disconnect-VIServer -Confirm:$False
Last Updated (Wednesday, 13 May 2009 15:51)