Group Poilicy update on a remote machine | Showing My Geek


, 7 Guests, 3 Bots


Print This Post Print This Post

Group Policy update on a remote machine

I’m over in Korea and we are working on systems that are scattered all through 7 different buildings.  It is only a few hundred machines but pushing out Group Policy updates is a pain with them scattered all over.  So This little script will send out a update using the gpupdate command.  We don’t have any of the fancy software that will do this for you either.  So this is what we did.

This assumes you are running a domain so you have admin privilege on all workstations.  First you will need a list of your machine names, we call it a nodelist.  You will also have to go to Sysinternals and get the free PsExec tool.  PsExec allows you to connect remotely to the workstations through a command line terminal.  The psexec.exe has to be in the same folder as the batch file.  Finally you just build you batch file.  Here is what I did.

@echo off

echo ************************************************


echo ************************************************






echo  This will update the GPO on all machines in the nodelist and reboot them

echo  writing the node info to the logfile.txt


For /f %%n IN (nodelist.txt) DO echo *********************************************** >> logfile.txt && echo  %%n >> logfile.txt && echo ************************************* >> logfile.txt && psexec.exe \\%%n -d gpupdate /force /boot >> logfile.txt


echo Process is complete.  Check the logfile for errors


This will write the workstation name and the output from the process with a complete status to the logfile.  I like to add in menus to my scripts so you can get ride of all of of it and just run the for statement.  we ran this on 217 machines several times to push printers and other policies to the workstations now instead of waiting.  Plus the way we do printers requires the machines to reboot after an update.

Test it out and see if it can work for you.  I like psexec and it is a handy tool for executing batch file and commands on remote hosts.  I just put this out there because when you are looking for easier ways to do this, they can be hard to find.  Goodluck.

Leave a Reply




You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

Time limit is exhausted. Please reload the CAPTCHA.