Solved

gpupdate bat file

Posted on 2012-03-12
11
8,374 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
  • 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
 
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
Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

 
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 24

Expert Comment

by:lionelmm
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 24

Expert Comment

by:lionelmm
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 24

Accepted Solution

by:
lionelmm 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

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

With most software applications trying to cater to multiple user needs nowadays, the focus is to make them as configurable as possible. For e.g., when creating Silverlight applications which will connect to WCF services, the service end point usuall…
This article describes how to set permissions to allow a limited-permissions user to start and stop a particular System Service.   It is always best to give users only the permissions that they need to perform their job, so tweaking particular permi…
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). …
With the advent of Windows 10, Microsoft is pushing a Get Windows 10 icon into the notification area (system tray) of qualifying computers. There are many reasons for wanting to remove this icon. This two-part Experts Exchange video Micro Tutorial s…

707 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now