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.
mishcondereyaAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

merowingerCommented:
sure!


set objShell = CreateObject("Wscript.Shell")
objShell.Run "gpupdate /force",0,true
0
mishcondereyaAuthor Commented:
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.
0
merowingerCommented:
The script is waiting for the gpupdate.exe. I assume it is the "please logoff message"


The following will just exeute the command and then stop processing:

objShell.Run "gpupdate /force",0,false
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

mishcondereyaAuthor Commented:
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"?
0
merowingerCommented:
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.
0
mishcondereyaAuthor Commented:
Too good!!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
VB Script

From novice to tech pro — start learning today.