Advertisement
Cogger

Win-Update.ps1

Jan 10th, 2022
182
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.     #Define Title
  2.         $host.UI.RawUI.WindowTitle = "Update Windows"
  3.     #Define Function to set color
  4.         function color ($bc,$fc) {
  5.             $a = (Get-Host).UI.RawUI
  6.             $a.BackgroundColor = $bc
  7.             $a.ForegroundColor = $fc ; cls}
  8.  
  9.     #Set color
  10.         color "DarkGray" "White"
  11.  
  12.     #Set size of console shell
  13.         cmd /c MODE con:cols=135 lines=30
  14.  
  15.     # Ensure that services are started
  16.         Start-Service -Name BITS
  17.         Start-Service -Name wuauserv
  18.         Start-Service -Name cryptSvc
  19.         Start-Service -Name msiserver
  20.  
  21.     #Run the script to install Windows Updates.
  22.         Write-Host('Searching, Downloading, and Installing Updates...')
  23.         Install-WindowsUpdate -AcceptAll -MicrosoftUpdate
  24.  
  25.    
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement