dump/Windows/PSPatching.ps1
Upgrayedd b65e728162 Update Windows/PSPatching.ps1
bypass execution policy to avoid issue importing module
2024-07-31 18:51:01 -05:00

17 lines
524 B
PowerShell

[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force
Install-Module PSWindowsUpdate -Force
Set-ExecutionPolicy bypass
Import-Module PSWindowsUpdate
Get-WUList -verbose
Install-WindowsUpdate -AcceptAll -ignorereboot | Out-File "C:\Windows\Temp\$(get-date -f yyyy-MM-dd)-WindowsUpdate.log" -force
Get-WURebootStatus -silent
$tonight = (Get-Date -Hour 23)
Get-WURebootStatus -ScheduleReboot $tonight | select RebootScheduled