Link to home
Start Free TrialLog in
Avatar of lunchbyte
lunchbyte

asked on

Group Policy, push out a Batch file

I am running Windows Server 2003 (SP1) and it is the DC.  I am also new to Active Directory and setting up Group Policys.  I have a program that I would like to install on all the PCs on the network and have a batch fie setup to run the install, it has been tested and runs fine.  (I tried doing a MSI and found the batch file is the easiest way due to how the program's install is setup.)  This batch file only needs to run one time   I haven't found instructions that I am 100% confident in on how to use Group Policy to deploy this batch file.  Can someone give me step by step instructions on how to do this?  Or is there another way I should be doing this?
Avatar of sirbounty
sirbounty
Flag of United States of America image

Setup your batch file like this:

@echo off
If exist c:\Program.flg goto :eof
::your code to call the install
echo Installed > c:\Program.flg

The first time it's called, it'll skip over the first line (excluding the @echo off) - and will call your install routine.
Then, it'll write a flag file to the root of c: - the next time it runs, it'll check for that flag file before proceeding - if it exists, it'll just exit the script.
Avatar of lunchbyte
lunchbyte

ASKER

Thanks for the code to add the flag file. Very helpful.  Just need the instructions on adding it to Group Policy and I'm set.  Thanks again.
Right-click your domain, choose properties.
You'll want to click Edit there
The scripts are located under User Configuration, Windows Settings, Scripts, Logon Scripts...drop a reference to your batch file there.
I guess this is where I'm getting tripped up.  When I right click on my domain in Group Policy Management then properties I have two tabs, General & Manage by.  I do not have an option to click on Edit under either tab.
Open up Active Directory Users & Computers (Start->Run->Dsa.msc if you have the admin tools installed or are on a DC).
Now, right-click your domain, and choose properties
Under the Group Policy tab, do you have any GPOs listed?
You can choose to edit one there, or edit the default domain policy...
Under Active Directory User & computers when I get to the Group Policy tab it says the Group Policy snap-in has been installed, so the tab is no longer used.  From there I have the open button which opens Group Policy Management.

By the way, I'll max out the points on this.  Thanks for the help.
Hmm - I'm not really sure on that...I'm not the group policy-guru 'round here...perhaps another expert will be able to guide you on that.  I've always used Aduc when modifying my polices...
I think I found it, is the window I need to be in called Group Policy Object Editor?  If it is, all I did was right click on 'my default policy' and clicked on edit.  From there I found what you posted in your second comment.

This seem obvious but, if I want the script to run on each computer I would put it under computer configuration, correct?  What I'm installing is a software inventory program and want to know what is on each system and really doesn't matter who the user is.
ASKER CERTIFIED SOLUTION
Avatar of sirbounty
sirbounty
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks a ton for the help.
Glad I could assist you.  Thanx for the grade! :^)