Link to home
Create AccountLog in
VB Script

VB Script

--

Questions

--

Followers

Top Experts

Avatar of mishcondereya
mishcondereya🇬🇧

GPUpdate /force VBS
Hi

I need to run a GPUpdate /force in VBS as part of the Computer Startup Script. Is this possible? Reason I ask is because PC's do not appear to be syncing to our GPO's correctly, so at the moment I'm having to run a gpupdate /force on all users PC's manually.

I have got a batch file, but would prefer to have this in my VBS.
CD\
echo No|gpupdate /force

Any ideas?

Thanks.

Zero AI Policy

We believe in human intelligence. Our moderation policy strictly prohibits the use of LLM content in our Q&A threads.


Avatar of merowingermerowinger🇩🇪

sure!


set objShell = CreateObject("Wscript.Shell")
objShell.Run "gpupdate /force",0,true

Avatar of mishcondereyamishcondereya🇬🇧

ASKER

Cool.

I copied the above into a test VBS, but the wscript.exe has been in my task manager for at least 4 minutes now. When I run GPupdate from cmd manually and say NO to log off, it only takes about 40 seconds.

Could it be waiting for some kind of user input, but in the background? Or has this script been specifically designed for the Computer Startup Script only, and not to be used during Windows?

Thanks.

ASKER CERTIFIED SOLUTION
Avatar of merowingermerowinger🇩🇪

Link to home
membership
Log in or create a free account to see answer.
Signing up is free and takes 30 seconds. No credit card required.
Create Account

Avatar of mishcondereyamishcondereya🇬🇧

ASKER

Just checked in the event viewer and there was an event that says "Security policy in the Group policy objects has been applied successfully."

So I'm assuming that it did run, but only when applied to the Computer Startup Script?

Silly question, but what is the difference between True and False. Do they both do what I want, but False bypasses the "please logoff message"?

Reward 1Reward 2Reward 3Reward 4Reward 5Reward 6

EARN REWARDS FOR ASKING, ANSWERING, AND MORE.

Earn free swag for participating on the platform.


Avatar of merowingermerowinger🇩🇪

Yes of course. It has been executed successfully, the only problem was that the gpupdate.exe waited for some user input. I assume the "logoff message"

The difference is that if you choose "true". 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.

Avatar of mishcondereyamishcondereya🇬🇧

ASKER

Too good!!
VB Script

VB Script

--

Questions

--

Followers

Top Experts

VBScript (Visual Basic Scripting Edition) is an interpreted scripting language developed by Microsoft that is modeled on Visual Basic, but with some important differences. VBScript is commonly used for automating administrative and other tasks in Windows operating systems (by means of the Windows Script Host) and for server-side scripting in ASP web applications. It is also used for client-side scripting in Internet Explorer, specifically in intranet web applications.