Skip to content

Instantly share code, notes, and snippets.

@lnksz
Last active November 27, 2023 09:22
Show Gist options
  • Save lnksz/d565c1de449aa94827d6dd37724a5431 to your computer and use it in GitHub Desktop.
Save lnksz/d565c1de449aa94827d6dd37724a5431 to your computer and use it in GitHub Desktop.
Windows 10/11 unattended updates
echo %date% %time% Updating >> C:\SOMEPATH\unattended-updates\log.txt
C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -ExecutionPolicy Bypass -File "C:\SOMEPATH\unattended-updates\upmyms.ps1" 1>>C:\SOMEPATH\unattended-updates\log.txt 2>&1
echo %date% %time% DONE >> C:\SOMEPATH\unattended-updates\log.txt
# One-Time
# Install PSWindowsUpdate from Gallery from and Admin Shell
# This may ask to install NuGet via PowerShellGet
Install-Module -Name PSWindowsUpdate -Force
# Task
Write-Output "=== Start CHOCO Update"
choco upgrade all -y
Write-Output "=== Start Windows Update"
Get-WUList -MicrosoftUpdate
Get-WindowsUpdate -AcceptAll -Install -AutoReboot
Write-Output "=== DONE ==="
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment