I’m trying to get a powershell script put out in our environment to forcibly install windows updates and reboot, silent to the user.<\/p>\n
Advertisement
Before anyone jumps on the WSUS bandwagon, it works in some cases, but as we all know it is well flawed too.<\/p>\n
What I want to get running is essentially three steps<\/p>\n
1- install the PSWindowsUpdate module, and skip this step if it is already installed.<\/p>\n
2- run the command “Install-WindowsUpdate -AcceptAll -AutoReboot”<\/p>\n
The problems I am running into:<\/p>\n
With step 1, no matter the options or flags I choose (like -force and/or -confirm:$false), I still get prompted to install the NuGet provider. I want this to be accepted automatically without any prompts.<\/p>\n
With step 2, I have had to make the command “powershell.exe -executionpolicy bypass Install-WindowsUpdate -AcceptAll -AutoReboot” to avoid it erroring out due to the exeecution policy.<\/p>\n
I want to get this all wrapped up into a pretty little .ps1 file, but I need to get step 1 working completely silent to the users before I push the script and schedule it with task scheduler…<\/p>\n