1
0
Prechádzať zdrojové kódy

Updated script for Windows

pmacko 2 týždňov pred
rodič
commit
2b20f5cf1b
1 zmenil súbory, kde vykonal 16 pridanie a 0 odobranie
  1. 16 0
      update.ps1

+ 16 - 0
update.ps1

@@ -0,0 +1,16 @@
+Set-ExecutionPolicy RemoteSigned -Scope Process -Force
+if (-not (Get-Module -ListAvailable -Name PSWindowsUpdate)) {
+    Install-Module -Name PSWindowsUpdate -Force -Confirm:$false
+}
+Import-Module PSWindowsUpdate
+Write-Host "- Check updates"
+$updates = Get-WindowsUpdate
+if ($updates.Count -eq 0) {
+    Write-Host "- Not find any new updates" -ForegroundColor Green
+    return
+}
+Write-Host "- Available updates:" -ForegroundColor Yellow
+$updates | Select Title, KB, Size
+Write-Host "- Download and install updates"
+Install-WindowsUpdate -AcceptAll -AutoReboot -IgnoreReboot
+Write-Host "- Finished, need reboot device" -ForegroundColor Green