{"id":19020646,"url":"https://github.com/simeononsecurity/chocoautomatewindowsupdates","last_synced_at":"2025-04-23T06:01:41.476Z","repository":{"id":110917565,"uuid":"281812866","full_name":"simeononsecurity/ChocoAutomateWindowsUpdates","owner":"simeononsecurity","description":"Automate Windows Updates with Chocolatey and PSWindowsUpdates","archived":false,"fork":false,"pushed_at":"2020-08-11T18:41:33.000Z","size":11,"stargazers_count":9,"open_issues_count":0,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-17T20:40:48.985Z","etag":null,"topics":["automated","chocolatey","powershell","reboot","shutdown","shutdown-script","startup","windows","windowsupdate"],"latest_commit_sha":null,"homepage":"https://simeononsecurity.com/github/automating-windows-updates-with-chocolatey-pswindowsupdate-and-startup-scripts/","language":"PowerShell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/simeononsecurity.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":["simeononsecurity"],"custom":["https://simeononsecurity.com","https://simeononsecurity.com/recommendhome","https://simeononsecurity.com/affiliate","https://twitter.com/simeonsecurity","https://discord.io/cybersentinels"]}},"created_at":"2020-07-23T00:37:11.000Z","updated_at":"2024-07-27T11:08:36.000Z","dependencies_parsed_at":"2023-03-13T13:46:56.480Z","dependency_job_id":null,"html_url":"https://github.com/simeononsecurity/ChocoAutomateWindowsUpdates","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simeononsecurity%2FChocoAutomateWindowsUpdates","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simeononsecurity%2FChocoAutomateWindowsUpdates/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simeononsecurity%2FChocoAutomateWindowsUpdates/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simeononsecurity%2FChocoAutomateWindowsUpdates/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/simeononsecurity","download_url":"https://codeload.github.com/simeononsecurity/ChocoAutomateWindowsUpdates/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250379787,"owners_count":21420841,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["automated","chocolatey","powershell","reboot","shutdown","shutdown-script","startup","windows","windowsupdate"],"created_at":"2024-11-08T20:17:56.060Z","updated_at":"2025-04-23T06:01:40.449Z","avatar_url":"https://github.com/simeononsecurity.png","language":"PowerShell","funding_links":["https://github.com/sponsors/simeononsecurity","https://simeononsecurity.com","https://simeononsecurity.com/recommendhome","https://simeononsecurity.com/affiliate","https://twitter.com/simeonsecurity","https://discord.io/cybersentinels"],"categories":[],"sub_categories":[],"readme":"***Automating Windows Updates with Chocolatey, PSWindowsUpdate, and Startup Scripts***\n\n     In today's modern workplace environment, system administrators constantly are battling for time. Rolling out the latest Windows updates can be extremely time consuming taking up to a week given enough systems.\nAlong with some assistance from Chocolatey, PSWindowsUpdates, and Startup Scripts, Systems Administrators can roll out update with as little as a single reboot of each machine.\n\n\nThe script we will be working with today titled \"*chocoautomatewindowsupdates.ps1*\":\n\n```\nSet-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))\nchoco feature enable -n=allowGlobalConfirmation\nchoco feature enable -n useFipsCompliantChecksums\nchoco upgrade all\nchoco install pswindowsupdate\nAdd-WUServiceManager -ServiceID 7971f918-a847-4430-9279-4a52d1efe18d -Confirm:$false\nInstall-WindowsUpdate -MicrosoftUpdate -AcceptAll \nGet-WuInstall -AcceptAll -IgnoreReboot\n```\n\nFrom [Chocolatey](https://chocolatey.org/install), the script below installs the Chocolatey package manager:\n```\nSet-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))\n```\n\nFolowed by a couple prefered Chocolatey configuration changes;\n``` \nchoco feature enable -n=allowGlobalConfirmation\nchoco feature enable -n useFipsCompliantChecksums\nchoco upgrade all\n```\n\nLastly we will install and run [PSWindowsUpdates](https://www.powershellgallery.com/packages/PSWindowsUpdate/2.0.0.4) to install all of the available windows updates.\n```\nchoco install pswindowsupdate\nAdd-WUServiceManager -ServiceID 7971f918-a847-4430-9279-4a52d1efe18d -Confirm:$false\nInstall-WindowsUpdate -MicrosoftUpdate -AcceptAll \nGet-WuInstall -AcceptAll -IgnoreReboot\n```\n\n     Now that we have our script set up. Now we need to set it up as a startup/shutdown script.\nWe have chosen to set it up as a shutdown script to avoid having to reboot twice.\nWe will be following the tutorial from [Microsoft](https://docs.microsoft.com/en-us/previous-versions/windows/it-pro/windows-server-2012-R2-and-2012/dn789190(v=ws.11)) to do this.\n\nIn the windows gui perform the following steps:\n\n1.) Open the Local Group Policy Editor by hitting **\"Win + R\"** and typing **\"gpedit.msc\"** followed by **\"Ctrl + Shift + Enter\"**\n\n2.) Navigate to Computer **Configuration\\Windows Settings\\Scripts (Startup/Shutdown).**\n\n3.) In the results pane, double-click Shutdown.\n\n4.) Select the powershell tab\n\n5.) In the Shutdown Properties dialog box, click Add.\n\n6.) In the Script Name box, type the path to the script, or click Browse to search \"*chocoautomatewindowsupdates.ps1*\" in the Netlogon shared folder on the domain controller.\n\n7.) Reboot\n\n8.) Profit?\n\nNow in the future, all an administrator has to do is reboot the computer to perform windows updates. \n\nThe same steps can be performed in GPO to acomplish the same thing on multiple Windows machines at the same time.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsimeononsecurity%2Fchocoautomatewindowsupdates","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsimeononsecurity%2Fchocoautomatewindowsupdates","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsimeononsecurity%2Fchocoautomatewindowsupdates/lists"}