Powershell: Wait, install updates, reboot

Modified on Tue, 22 Apr at 6:35 PM

# Force TLS 1.2
[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12
# Install PSWindowsUpdate Module
Install-Module -Name PSWindowsUpdate -Force

#####

# Wait for 3 hours (10800 seconds)
Start-Sleep -Seconds 10800

# Install all available Windows updates
Install-WindowsUpdate -AcceptAll -AutoReboot

# Reboot the system
Restart-Computer -Force

Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article