
Start-Process -FilePath $cfg -ArgumentList "-x -monitor-timeout-ac 0" $cfg = "c:\windows\system32\powercfg.exe" #checks if Windows build number is Windows 21H1 or higher, exit if is $varBuild = (Get-CimInstance Win32_OperatingSystem).buildNumber #Checks if Windows version is Windows 8.1 or lower, exit if it is #Set Execution Policy so Powershell scripts can be run on remote PC Once the user restarts their computer it will finish the update. The only caveat is that it won't let the user know when it's finished (if that's something you want). Then it waits for the "setuphost" process to run, checks in that it's running, and stops the Update Assistant ("Windows10UpdaterApp" process) when "setuphost" stops running. It then runs the Update Assistant silently. Then it downloads the Windows Update Assistant to the C:\ drive and loops to check for the file. If it is, sets the power settings so the computer won't go to sleep and closing the lid won't do anything. Some of this is circumstantial for our environment, but the core of it works.īasically the script checks to see if the computer is between Windows 8.1 and Windows 10 21H2. I want to note that I am using NinjaOne (formally NinjaRmm) to deploy this script using domain admin credentials.


I FINALLY figured out how to get this to work with some help from this thread. I know this is older, but hopefully this helps someone. I ran the installer against strings64 and found the following switches in the output, but none of them appear to prevent the restart, and in fact there are fewer in here than I have with the code above that I got from a web site: /PushĪnyone know if there's an undocumented switch I can use to force the app to prompt the user if logged in and restart with no prompt if no one is logged in? I'm trying to avoid the loss of work/data where possible. Start-Process -FilePath $file -ArgumentList '/quietinstall /skipeula /auto upgrade /copylogs $dir' The core section is: $dir = 'C:\_Windows_FU\packages' I've got a powershell script that downloads and runs the Windows 10 Update Assistant to get our laptops onto the latest Feature Update, problem is with this script it doesn't prompt the user, it just restarts the laptop without prompt.
