Force Windows Update to Search for Updates Again
Command line to force a Windows Update check
I have a small number of machines that will be off most of the time, but when the user turns them on and logs in I want to accept a script to perform a Windows Update using the default settings you would get if you click the "Cheque for updates" button. This includes checking and installing any updates.
Note: The solution CANNOT crave admin privs.
34 Replies
-
Batchfile
PowerShell.exe (New-Object -ComObject Microsoft.Update.AutoUpdate).DetectNow()
or
Powershell
( New-Object -ComObject Microsoft . Update . AutoUpdate ). DetectNow ()
depending if you're doing Command prompt or PowerShell prompt.
thumb_up thumb_down
-
Could you lot run a bat file from the run part of HKLM?
wuauclt /detectnow
or something like this PowerShell script?
https://community.spiceworks.com/topic/1649924-powershell-script-for-windows-updates-security-and-cr...
You'd need to trigger it from the registry or as another user (perhaps scheduled task at login)
thumb_up thumb_down
-
Likewise, I've found that Windows 10 does this actually automatically when the computer has not been on in a while.
thumb_up thumb_down
-
Could you run a bat file from the run function of HKLM?
wuauclt /detectnow
or something like this PowerShell script?
https://community.spiceworks.com/topic/1649924-powershell-script-for-windows-updates-security-and-cr...
You lot'd demand to trigger it from the registry or as another user (perhaps scheduled job at login)
/Detectnow is deprecated
https://world wide web.ajtek.ca/wsus/does-wuauclt-exe-detectnow-reportnow-work/
thumb_up thumb_down
-
Also, I've found that Windows 10 does this actually automatically when the reckoner has non been on in a while.
I've seen the autodetection, simply information technology doesn't auto install. These are PCI machines and I need them to install.
thumb_up thumb_down
-
Besides, I've plant that Windows ten does this really automatically when the computer has not been on in a while.
I've seen the autodetection, merely it doesn't auto install. These are PCI machines and I need them to install.
How will you handle the restart requirement for installing updates? Usually this autodetection and initiating of installation, restart, and report dorsum is all done through GPO settings, coupled with the borderline on updates at the WSUS level.
You lot could endeavor one of the UsoClient.exe switches - although I oasis't had luck with them.
https://world wide web.ajtek.ca/wsus/client-machines-not-reporting-to-wsus-properly/#to=ClientSideScriptLongExplanation&start=-155
thumb_up thumb_down
-
Batchfile
PowerShell.exe (New-Object -ComObject Microsoft.Update.AutoUpdate).DetectNow()
or
Powershell
( New-Object -ComObject Microsoft . Update . AutoUpdate ). DetectNow ()
depending if you're doing Command prompt or PowerShell prompt.
Adam, will the detectNow() also install or is there a different command needed to install? I tin can't seem to observe the documentation on the Microsoft.Update namespace or class.
thumb_up thumb_down
-
Besides, I've found that Windows 10 does this actually automatically when the estimator has non been on in a while.
I've seen the autodetection, but it doesn't auto install. These are PCI machines and I need them to install.
How volition you handle the restart requirement for installing updates? Commonly this autodetection and initiating of installation, restart, and report dorsum is all done through GPO settings, coupled with the deadline on updates at the WSUS level.
You lot could try one of the UsoClient.exe switches - although I haven't had luck with them.
https://www.ajtek.ca/wsus/client-machines-not-reporting-to-wsus-properly/#to=ClientSideScriptLongExplanation&offset=-155
I have my users trained to restart their PCs at the end of the twenty-four hours. In this case just doing the shutdown will be sufficient every bit the install will proceed on the next power up.
thumb_up thumb_down
-
jrp78
This person is a verified professional person.
Verify your account to enable IT peers to meet that y'all are a professional.
-
You lot can check out the PSWindowsUpdate module as well. I don't utilise it personally just I call back many do.
https://www.powershellgallery.com/packages/PSWindowsUpdate/2.two.0.two
https://www.parallels.com/blogs/ras/powershell-windows-update/
Unfortunately it requires admin privs to run the Install-Module commandlet. This is what I tried showtime.
thumb_up thumb_down
-
I accept struggled with this too. I have several ways to download the update merely Windows will not install information technology. Especially the large updates like 21H2 that merely came out. I ended up trying to have the end user striking the Install push merely that is not reliable. I hope someone has a solution that I can't find.
thumb_up thumb_down
-
Yous can check out the PSWindowsUpdate module likewise. I don't employ it personally simply I remember many practice.
https://www.powershellgallery.com/packages/PSWindowsUpdate/2.2.0.two
https://www.parallels.com/blogs/ras/powershell-windows-update/
Unfortunately it requires admin privs to run the Install-Module commandlet. This is what I tried first.
How are you triggering these updates? I don't run across why you couldn't avoid your admin issues if you just utilize the task scheduler and run tasks as system.
thumb_up thumb_down
-
The password would have to change every 45 days - Yeah, did I every say the PCI Quango is so far behind best password practices information technology'due south not even funny?
thumb_up thumb_down
-
The password would have to change every 45 days - Aye, did I every say the PCI Council is so far behind best password practices it's not even funny?
Countersign rotation doesn't employ to the SYSTEM account. Well, you don't have to input a PW for the Arrangement account in the task I should say. Windows handles that function of it just like a gMSA.
thumb_up thumb_down
-
endeavour the following control:
Text
usoclient startinteractivescan
Had some success getting this to work with PDQ scripts to force an update check.
thumb_up thumb_down
-
I'm curious as to why you would want windows update to run when the user logs in and not when they log off instead to reduce downtime?
thumb_up thumb_down
-
To kick off updates on Win ten, I utilize a batch file that contains this:
start ms-settings:windowsupdate-activity
Works for me, your mileage may vary. Might also piece of work well from the Task Scheduler with 'starts at login' trigger.
thumb_up thumb_down
-
I take struggled with this equally well. I have several ways to download the update merely Windows volition not install it. Especially the large updates like 21H2 that just came out. I ended up trying to take the stop user hitting the Install push but that is not reliable. I promise someone has a solution that I can't find.
Nosotros do this via GPO. Download and install in one step. piece of cake going.
For Upgrades like 21H1 etc... i moved away from WSUS and utilize a small batch file:UNCPath\to\21H1\setup.exe /car upgrade /repose /NoReboot
Works great.
Batchfile
UNCPath\to\21H1\setup.exe /car upgrade /quiet /NoReboot
thumb_up thumb_down
-
Accept you lot tried " wuauclt.exe/updatenow"?
thumb_up thumb_down
-
Also, I've found that Windows 10 does this actually automatically when the computer has non been on in a while.
I've seen the autodetection, but information technology doesn't auto install. These are PCI machines and I demand them to install.
If you're using an internal update manager similar WSUS you lot can set a deadline for install: if the machine is by that bespeak it will install the updates and prompt for a reboot. Adam (AJ Tek) should exist able to confirm, but this has been my experience.
If you lot're just pulling from Microsoft, yous may exist able to implement something like through GPO.
thumb_up thumb_down
-
This is a script I take used in the by to install windows updates and autoreboot
Python
#Install-Module PSWindowsUpdate -Confirm:$false -Force -SkipPublisherCheck -AllowClobber # Install required modules Install - PackageProvider - Name NuGet - MinimumVersion 2.8 . five.201 - Force Install - Module pswindowsupdate - force Import - Module PSWindowsUpdate - force # End installing required modules #Get list of windows updates to install Get - WindowsUpdate #install the updates Install - WindowsUpdate - AcceptAll - install - AutoReboot
You could easily change the -AutoReboot flag to -IgnoreReboot.
To automate information technology set up it upwards as a scheduled task that runs in the system context someday there is a logon or startup event on your laptop. Then you don't demand to input any credentials.
thumb_up thumb_down
-
Have you looked into the PSWindowsUpdate Module for PowerShell? I use information technology all the fourth dimension and it has always worked for me. I too accept information technology write a log and then I tin can encounter what information technology did.
Powershell
Install-WindowsUpdate -AcceptAll -MicrosoftUpdate -Install -AutoReboot -Verbose | Format-Tabular array -Wrap | Out-File "C:\ $( go-engagement -f yyyy-MM-dd ) -WindowsUpdate.log" -Append -force
thumb_up thumb_down
-
I'thousand curious as to why you would want windows update to run when the user logs in and non when they log off instead to reduce reanimation?
Because I expect they volition exercise a shutdown then they put the machine dorsum in the drawer until they need to run their side by side credit card.
thumb_up thumb_down
-
If all else fails, fire up Powerpoint, kickoff a presentation it'll update!!
I had GP and WSUS doing updates and restarting over night, nevertheless you desire it to be at start up.
thumb_up thumb_down
-
Before we purchased an actual patch management program, we used to use a .bat file we would periodically run after logging into a machine.
Technically, there were two, but the commencement simply copied the needed files for the second i to run.
The first batch file only needs to be run once per machine.
The second batch file needs to be run every time you lot desire to update each machine.I'm adequately certain this requires admin rights, but thought I would put it out here in instance it might aid spark something else for you.
"Because you lot never know!"
1st batch file contents:
Text
@repeat Hither nosotros go. mkdir C:\Windows\System32\WindowsPowerShell\v1.0\Modules\PSWindowsUpdate\ copy "\\UNC_Path_To_Files\MicrosoftUpdatePowerShell\PSWindowsUpdate\*.*" "C:\Windows\System32\WindowsPowerShell\v1.0\Modules\PSWindowsUpdate\*.*" /Y @echo Check it. Good? interruption
2d batch file contents
Text
@echo Allow'southward practise it. powershell.exe -Command "ipmo PSWindowsUpdate; Get-WUInstall -MicrosoftUpdate -AcceptAll -IgnoreReboot -Verbose | Out-File c:\PSWU.txt" interruption
thumb_up thumb_down
-
I'm curious as to why you lot would desire windows update to run when the user logs in and not when they log off instead to reduce reanimation?
Because I expect they volition practice a shutdown so they put the car back in the drawer until they need to run their next credit carte du jour.
That feels like asking a lot :-)
In my feel they would either
A. walk away leaving information technology on and logged in
or
B. Close the lid putting it to slumber and tell yous they shut it down
thumb_up thumb_down
-
Login script that PSExec'southward the above suggestions and then forces a reboot? Login script should run equally Local Admin/Organization.
**EDIT - forgive me. Non PSEXEC, but something more like this:
powershell.exe -NoProfile -ExecutionPolicy Bypass -Control "& 'c:\scripts\ForceUpdates.ps1'"
thumb_up thumb_down
-
If all else fails, burn down up Powerpoint, outset a presentation information technology'll update!!
#TRUTH
thumb_up thumb_down
-
I'k not sure exactly how this related to windows update, but my co-worker a few years back (in charge of windows updates) created a task in task scheduler, that ran at Sunday night at 1:30am, it would run c:\windows\system32\mschedexe.exe
This is the windows retentiveness diagnostic program... non sure what this has to do with windows updates, but the title of the task is update scheduler.??
I've been looking for a mode to remotely trigger windows updates, even check for updates from microsoft, but I'm non sure how this fits into that...?
If there is something I've missed well-nigh the memory diagnostic programme, please let me know if you tin get it to work for you.
Regards,
Jeff Cummings
MIS Technician
thumb_up thumb_down
-
To automate it set information technology up equally a scheduled task that runs in the organization context anytime there is a logon or startup event on your laptop. And then you don't need to input any credentials.
Can I utilise GPO scheduled task without need to insert credentials later when the password will change?
And more than of import question... if the device is shutdown, it would run the script one time, I know there is a switch for that " -RecourseCycle" so it could run several times merely how does it work with restarts? It won't create a loop and run the script twice (once later on restart and once because the switch).Beside PSWindowsupdate doesn't install featured updates similar the 21H2 updates, in that location is a way to download both "normal security updates" and featured updates?
thumb_up thumb_down
-
Yous could try Windows Update for Business GPOs. It allows setting a deadline for updates install based on time afterwards they are released and a borderline for reboots. I believe you lot can also ready the interval for update checks, and then setting that to nonetheless pocket-size possible should help meet your requirement of having updates install shortly after startup.
We accept been using WUfB for a while now as nosotros wanted to reduce our server manor, dropping WSUS in the process, and it'southward been working perfect and then far.
thumb_up thumb_down
-
You could try Windows Update for Business GPOs. It allows setting a deadline for updates install based on time afterward they are released and a borderline for reboots. I believe you can too set the interval for update checks, and then setting that to notwithstanding pocket-size possible should assistance meet your requirement of having updates install shortly after startup.
We have been using WUfB for a while now every bit we wanted to reduce our server manor, dropping WSUS in the process, and it'southward been working perfect so far.
That's besides possible with WSUS - the rolling deadline - problem is that it doesn't utilise here - considering the rolling deadline wouldn't be hit until the next time the system boots.
As well, enabling WUfB policies and using WSUS will create a dual scan scenario, negating the fact that you're using WSUS.
https://www.ajtek.ca/wsus/dual-browse-making-sense-of-why-and then-many-admins-have-problems/
thumb_up thumb_down
-
I accept to use WSUS to update the machines on my electric current employer'due south domain and I always hated the fact that Windows 10 and Server 2019 have cleaved the wuauclt /detectnow feature. I take been trying to convince them to purchase SCCM, just until then I needed another solution. I played effectually a bit with solving this and created the post-obit BAT file which works nicely to force machines to 'check in' with the WSUS server. I practice run them with elevated privileges only perhaps this will get you somewhere? You can suit the timeout to suite your needs, but the cmd prompt portion should run Later the powershell window completes and closes. The finish 'pause' can be omitted if you lot don't care to verify the results or don't desire end users to have to deal with a command prompt that is still open up (and potentially in elevated privilege condition).
__________________________________________________________
WMIC /node:"%computername%" process call create "PowerShell.exe $updateSession = new-object -com "Microsoft.Update.Session"; $updates=$updateSession.CreateupdateSearcher().Search($criteria).Updates"
timeout 20
WMIC /node:"%computername%" process call create "cmd.exe /c wuauclt.exe /reportnow"
intermission
thumb_up thumb_down
-
I have to use WSUS to update the machines on my current employer's domain and I always hated the fact that Windows ten and Server 2019 have broken the wuauclt /detectnow characteristic. I accept been trying to convince them to purchase SCCM, but until then I needed another solution. I played effectually a scrap with solving this and created the post-obit BAT file which works nicely to force machines to 'bank check in' with the WSUS server. I practise run them with elevated privileges just peradventure this volition get yous somewhere? You can adjust the timeout to suite your needs, merely the cmd prompt portion should run AFTER the powershell window completes and closes. The end 'break' can be omitted if yous don't intendance to verify the results or don't want end users to take to deal with a control prompt that is still open (and potentially in elevated privilege status).
__________________________________________________________
WMIC /node:"%computername%" procedure telephone call create "PowerShell.exe $updateSession = new-object -com "Microsoft.Update.Session"; $updates=$updateSession.CreateupdateSearcher().Search($criteria).Updates"
timeout 20
WMIC /node:"%computername%" procedure telephone call create "cmd.exe /c wuauclt.exe /reportnow"
break
See: https://www.ajtek.ca/wsus/does-wuauclt-exe-detectnow-reportnow-work/
Powershell
( New-Object -ComObject Microsoft . Update . AutoUpdate ). DetectNow ()
thumb_up thumb_down
Read these next...
-
New Responsive Superhead advertizement coming to Spiceworks
BetaWhile I know that ads are not your favorite subject, we e'er want to do our best to be upfront with all of you about the changes we're making to Spiceworks. We will be adding a new advertizing type to the Spiceworks website chosen the Responsive Superheader that...
-
Snap! Quick Assist, NIS2, symmetron, Super Flower Blood Moon, & an aroused IT pro
Spiceworks OriginalsYour daily dose of tech news, in cursory. Y'all need to hear this. Welcome to Monday, everyone! So far, information technology is a fairly placidity 1 and here's hoping information technology stays that way. Windows admins are so annoyed by Quick Assistance moving to Microsoft Store Micro...
-
Spark! Pro Series - 16th May 2022
Spiceworks OriginalsAs Mon dawns once again, the Spark! is here to illuminate, inform and entertain. If you like it, spice it up. If you don't, let me know and I'll try and improve next time. Never too former for constructive criticism...
-
Question regarding the use of user stories and employ cases in organizations
IT & Tech CareersI want to know the process organizations follow to make utilize of use cases and user stories. I also want to know the job role of those within that organization who are responsible for developing use-cases and user stories.
-
Easiest way to deploy software and settings on 10 Windows computers.
SoftwareI demand to setup 10 computers the exact aforementioned way with; Office, antivirus and other software.Likewise all computers accept virtually 12 shortcuts located in the quick-launch tray mostly going to web addresses.I accept never done a deployment like this earlier so the sim...
Source: https://community.spiceworks.com/topic/2341288-command-line-to-force-a-windows-update-check?slot=slot_1&source=slot-1-default
0 Response to "Force Windows Update to Search for Updates Again"
إرسال تعليق