Community-Blog icon indicating copy to clipboard operation
Community-Blog copied to clipboard

Using PowerShell for Automation: Running Windows Updates in a vSphere Cluster

Open uxlab9 opened this issue 4 years ago • 2 comments

Attempting to be more proficient at learning PowerShell by using PowerShell for Automation.

Problem Trying to solve: "Run weekly updates to my cluster of windows devices (50 servers & 50 desktops) that is in vSphere 6.7, " Question I want answered: "Review my following PowerShell I have tested to run the windows update on my Win10 local device, but I need assistance scripting out the rest of the PowerShell code for automation. " I have already written down all the cluster from vSphere 50 servers & 50 desktops in text file and called it computers.txt.


#Import-Module PSWindowsUpdate #Remove-Item -Path C:\Scripts\status.tx #Start-Transcript -Path C:\Scripts\status.txt #$Updates = "Critical Updates", "Security Updates" #Get-WUInstall -AcceptALL- Verbose -IgnoreReboot -Category $Updates #Write-Host "Done" #Stop-Transcript #Start-Sleep -s 120 #Restart-Computer -Force -Confirm:$false

-- after pc restarts run as PS As Administrator Get-WindowsUpdate


Thanks

uxlab9 avatar Jan 21 '22 19:01 uxlab9

Exported list of all installed Hotfixes on all Domain Computers. Disadvantage is you do not know whether the computers are on or off.

#Invoke-Command -ComputerName (Get-ADComputer -Filter *).Name {Get-HotFix} -ErrorAction SilentlyContinue | Select-Object PSComputername, HotfixID, InstalledOn | Out-GridView

If you want to know which computers are not reachable remove the parameter #ErrorAction SilentlyContinue

uxlab9 avatar Jan 25 '22 14:01 uxlab9

@uxlab9 Is this a blog post you want to write?

sdwheeler avatar May 20 '22 21:05 sdwheeler