PowerShell/Community-Blog

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

uxlab9 opened this issue · 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

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 Is this a blog post you want to write?