How do I make a gpo that runs a batch file, installs a software package (msi) then run another batch file?

Posted on 2010-03-25
Medium Priority
Last Modified: 2013-11-14
I have a program that has a strange situation. When you install the MSI, which is an upgrade, it pulls the location paths of local resources and shared (network mapped drive) from the computer. The install fails (error 1327, invalid drive) because it seems to be attempting to verify the shared mapped drive (it doesn't actually install anything to that path), which is not there until the user logs in, and some users do not have access to that drive. So, it seems the only fix I can find is a subst command, which works, but that drive letter is needed when the user logs in, so what I need is a way, preferably in the same gpo that:

1. runs the batch file (or just run the command itself)
2. Installs the software package
3. runs the other batch file (that deletes the virtual drive)

I was thinking just running it all in a batch file, but I don't want the msi to run everytime someone restarts the computer, as the install tags a few minutes on bootup time.

Domain controllers:
Windows Server 2k8 R2
Windows xp, windows 7

Question by:cubarushford
LVL 12

Expert Comment

by:Chris M
ID: 28558599
To run a batch file from command lime, use the following commands on Windows:
START command_u_want

E.g: START c:\myfile.bat

To un-map a network drive:


E.g: to unmap the G:\ network drive, here's how:

Let me know if you need any more help.

Expert Comment

ID: 28558749
LVL 41

Accepted Solution

Kyle Abrahams earned 2000 total points
ID: 28560711
The only thing I would add is to create a file on the c drive, say


In the bat file, first check if the file exists.  If it does, quit.  If not, then map the drive, launch the install, delete the drive as perscribed above, then create the file so that you know the upgrade was complete.

Next time the user logs in the batch runs and says this was already done.

Featured Post

Easily manage email signatures in Office 365

Managing email signatures in Office 365 can be a challenging task if you don't have the right tool. CodeTwo Email Signatures for Office 365 will help you implement a unified email signature look, no matter what email client is used by users. Test it for free!

Question has a verified solution.

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

I’m willing to make a bet that your organization stores sensitive data in your Windows File Servers; files and folders that you really don’t want making it into the wrong hands.
Native ability to set a user account password via AD GPO was removed because the passwords can be easily decrypted by any authenticated user in the domain. Microsoft recommends LAPS as a replacement and I have written an article that does something …
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…
Suggested Courses

592 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