Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Scripts before Group Policy on startup 2

Status
Not open for further replies.

Cstorms

IS-IT--Management
Sep 29, 2006
556
US
Hello, I am wondering if it is possible to launch a batch file (i know i know its not vbs) before group policy takes into effect? The reason is I want to run an uninstall of a program before installing the new version of that program, but since we didnt deploy it using group policy and it has to be uninstalled before installing the new one this seemed like the easiest way of going about it (launch the batch to startup the msiexec uninstall process). I am wondering if any of you knowledgeable chaps could let me know if thats possible somehow. Thanks in advance!
 
Not sure if this is what you mean, but in XP, go to
START > RUN > gpedit.msc

then go to COMPUTER CONFIG > WINDOWS SETTINGS > SCRIPTS > STARTUP and load the batch file in there. I'm pretty sure local policies go into effect before domain policies do.
 
Nothing is going to run before policies are applied. First, machine policies. Then after user logs in, user policies.

Can you package the new install package into an MSI? If so, then you could run your uninstall with your batch file. Create a software distribution policy and assign it to appropriate users who need it. When they go to use the app, it will install the package that you published via GPO.

Hope This Helps,

Good Luck!
 
you could call the uninstallstring value from vbs in a machine startup script. That would uninstall the previous version. The only problem I see with that is if the new version uses the same entry or GUID in the registry. If that's the case, it would uninstall every time the machine booted.

For an example on how to do it in vbs, see my post at thread329-1307626

Pat Richard, MCSE MCSA:Messaging CNA
Microsoft Exchange MVP
Want to know how email works? Read for yourself -
 
Hm...I didn't realize installation processes could run at machine startup. Thanks for the valuable post. A star for you!
 
First off thanks for the replies, I think what you have described would work but this would only be possible if I went to each machine and loaded this vbs script correct? If thats the case I was hoping for a solution that would be streamlined without that kind of interaction (in an effort to put less work into it). I have the msi setup with its correlating mst file and with my batch it uninstalls using the msiexec command with the uninstall reg key, it works fine and all but it would take 2 logons to complete the whole process. uninstall first with batch -> restart -> GP to install new version. I wanted to go uninstall -> "GP install here" -> restart/or shutdown

Am I way off base in this thinking or can you apply local machine polices remotely? Thanks


 
If you have a domain, there is no need to go to each machine to setup the script. All you need to do is configure a machine startup script group policy and link it to the appropriate OU's.

Hope This Helps,

Good Luck!
 
Right - define the script in a GPO. Going to every machine (aka "SneakerNet"), is way too much work.

Thanks for the star, MonsterJTA!

Pat Richard, MCSE MCSA:Messaging CNA
Microsoft Exchange MVP
Want to know how email works? Read for yourself -
 
Thanks for the helpful advice, I appreciate it!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top