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

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

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Chris MConsulting - Technology ServicesCommented:
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.
Kyle AbrahamsSenior .Net DeveloperCommented:
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.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.