|
|
@@ -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
|