Solved

gpupdate bat file

Posted on 2012-03-12
11
9,475 Views
Last Modified: 2012-03-13
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
0
Comment
Question by:drogi
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
  • 2
  • +2
11 Comments
 
LVL 11

Expert Comment

by:g000se
ID: 37709287
Hi,

Try this line-

echo Yes|gpupdate /force
0
 
LVL 9

Expert Comment

by:TazDevil1674
ID: 37709289
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
 
LVL 8

Expert Comment

by:Elmar-H
ID: 37709304
0
The Ultimate Checklist to Optimize Your Website

Websites are getting bigger and complicated by the day. Video, images, custom fonts are all great for showcasing your product/service. But the price to pay in terms of reduced page load times and ultimately, decreased sales, can lead to some difficult decisions about what to cut.

 
LVL 11

Expert Comment

by:g000se
ID: 37709306
Sry had one more item to add my post previously.  Try placing quotes around the word "yes"
0
 
LVL 8

Expert Comment

by:Elmar-H
ID: 37709333
gpupdate /force /boot works for me
0
 
LVL 1

Author Comment

by:drogi
ID: 37709345
echo yes|gpupdate /force /yes
I've tried this and no joy cmd just flashes and do nothing
0
 
LVL 25

Expert Comment

by:Lionel MM
ID: 37713947
What OS are you trying this on, version of Windows?
0
 
LVL 1

Author Comment

by:drogi
ID: 37714030
windows 7
0
 
LVL 25

Expert Comment

by:Lionel MM
ID: 37714493
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
 
LVL 25

Accepted Solution

by:
Lionel MM earned 400 total points
ID: 37714754
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
 
LVL 1

Author Closing Comment

by:drogi
ID: 37715304
thanks
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you ever had a hard drive that you can't boot into, but need to change the registry? Here is the solution! This article guides you through accessing and editing a registry of a non-primary drive. To read registry information on a non-prim…
A theme is a collection of property settings that allow you to define the look of pages and controls, and then apply the look consistently across pages in an application. Themes can be made up of a set of elements: skins, style sheets, images, and o…
This video Micro Tutorial explains how to clone a hard drive using a commercial software product for Windows systems called Casper from Future Systems Solutions (FSS). Cloning makes an exact, complete copy of one hard disk drive (HDD) onto another d…
In this video, we discuss why the need for additional vertical screen space has become more important in recent years, namely, due to the transition in the marketplace of 4x3 computer screens to 16x9 and 16x10 screens (so-called widescreen format). …

728 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question