The wscript.exe will wait until the gpupdate.exe is closed. If you choose 'false' it will not wait and just close independed of the gpudpate.exe. If you run the script with user rights (user logon script) it will update the user policy part. If you run it with computer rights (computer starup script) it will update the computer policy part. Local Group Policy editor can be launched by typing gpedit.msc in the Run dialog. By default, Group Policy is updated when the system starts. Additionally, Group Policy options are updated in the background every 90 minutes + a random offset of the 0 to 30 minute interval. Windows 8 (AFAIR) introduced GPO caching. That means that the sysvol content of all applied GPOs is copied locally. This copy is then used on subsequent startup and logon gpo processing. Running gpupdate manually will NOT use this cache. Also if you run gpupdate /force, this will enforce the cache to be renewed. To remotely GPUpdate, I actually prefer to use the SPECOPs GPUpdate tools (free edition). You can select an OU or just computers and remotely run a gpupdate (or gpupdate /force). It actually runs a PowerShell script to remotely update but ties into Active Directory Users and Computers.
Ever needed to run a cmd on a remote computer such as gpupdate? this will show you how.
This of course assumes you have admin access to the remote PC
2 Steps total
Step 1: Open an Administrative Command Prompt
Open the Command Prompt windows. Make sure you run as admin and use credentials with admin rights on the remote machine
Step 2: Run your command
Use this command.
WMIC /node:'Computer Name' process call create “cmd.exe /c GPUpdate.exe /force”
Just Replace 'Computer Name' with the name of the remote computer. To be safe keep the ' around the computer name. without the quotes some characters seem to cause issues with this command
This example will run the command GPUpdate.exe /force If you wish to run something else. replace this with the command you wish to run.
That is it. your command will execute on the remote system. The only downside to this method is that you can't see the command execute or the results if there was a error.
Force Gpo Updates
But in a pinch this can be a very handy command
- How to run a command remotely on computers
How To Run Gpupdate In Powershell
- Thai Pepperbobmccoy Mar 4, 2016 at 10:17pm
PSExec tends to be much faster. And if you have PowerShell remoting enabled, that is another option.
- DatilLaurel Raven Mar 5, 2016 at 01:11am
bobmccoy, that's true, but those are not always options. I recently had to do this (actually figured out how to do it with Invoke-WmiMethod, because I'm stubborn and wanted it to be a PowerShell solution), and in this environment, PSExec is disabled by security policy, and PS Remoting has never been enabled. I'm working on getting PS Remoting turned on, but having a backup to try for when those fail is always good.
- Macemolan Mar 5, 2016 at 02:05am
And it has the benefit of not needing to add anything to a base windows install. It is just there and enabled
- Serranojulianddavidson Mar 5, 2016 at 07:14am
Batchpatch is also good for this kind of thing. If you need to do it on lots of computers.
- Jalapenorobb4 Jul 12, 2018 at 07:50am
You'll also need to have Windows firewall already allowing WMIC in. This is not set by default. Guide to deploy the GPO is here:
- DatilPeter (Action1) Sep 13, 2018 at 06:05pm
if you need to run an application on multiple remote computers, I would recommend to use a third-party tool - Action1 can do this: https://www.action1.com/f/Free-Run-Application-with-Command-Line-atm-65.html