gpupdate bat file

hi guys
I'm looking batch file with will update polocies in domain envoriment and restart pc at prompt (after updateng polocies)
my batch file is now

"Echo Yes|gpupdate.exe /force"  BUT user still have click Y and enter and i want this be inclouded in bat

any ideas

all contributions much appreciated
LVL 1
drogiAsked:
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.

g000seCommented:
Hi,

Try this line-

echo Yes|gpupdate /force
0
TazDevil1674Commented:
Not all programs will accecpt text via a pipe.

Not something I have done recently but you might want to try

  gpupdate /force /yes

I know gpupdate /force /no stops the reboot...

HTH
0
Elmar KoschkaIT System EngineerCommented:
0
Cloud Class® Course: Python 3 Fundamentals

This course will teach participants about installing and configuring Python, syntax, importing, statements, types, strings, booleans, files, lists, tuples, comprehensions, functions, and classes.

g000seCommented:
Sry had one more item to add my post previously.  Try placing quotes around the word "yes"
0
Elmar KoschkaIT System EngineerCommented:
gpupdate /force /boot works for me
0
drogiAuthor Commented:
echo yes|gpupdate /force /yes
I've tried this and no joy cmd just flashes and do nothing
0
Lionel MMSmall Business IT ConsultantCommented:
What OS are you trying this on, version of Windows?
0
drogiAuthor Commented:
windows 7
0
Lionel MMSmall Business IT ConsultantCommented:
Option 1
Create this in a batch file
Rem This will create a scheduled task either local or remote and will run gpupdate within 1 minute, unless you specify a start time (ST)
SCHTASKS /Create /S ComputerName /U domain\username /P password /SC MINUTE /MO 1 /TN TaskName  /TR "gpupdate /force" /ST StartTime--defaults to now if no time specified
Rem This will then reboot your PC within 3 minutes
Shutdown -f -r -t  180 -m ComputerName

Alternatively you can create a batch file for the schedule to start instead of starting gpupdate directly. If you go this root you must either have the batch file on each system or have it ina central location all users have access to--I will assume a central location located at g:\Utils\GP-Update.Bat. In this option this batch file will be scheduled and not gpupdate and shutdown/restart will not start until gpupdate is done

Option 2
Create this in a batch file
Rem GP-Update.Bat
:gpupdate /force
Shutdown -f -r -t  120

Now create a scheduled task to run this batch file
SCHTASKS /Create /S ComputerName /U domain\username /P password /SC MINUTE /MO 1 /TN TaskName  /TR G:\Utils\GP-Update.bat /ST StartTime--defaults to now if no time specified

Depending on permissions and who you specify as /U user this by itself may work but if not you may have to use the run as user command /RU and /RP (note if passwords are not specified they will be asked for). Hope this helps.
0
Lionel MMSmall Business IT ConsultantCommented:
Correction--was :gpupdate (:) should be gpupdate without the :  -- sorry about that
Option 2
Create this in a batch file
Rem GP-Update.Bat
gpupdate /force
Shutdown -f -r -t  120
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
drogiAuthor Commented:
thanks
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
Microsoft Legacy OS

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.