Hello There

I'm in a desperate need to write a Batch file and it would be great to obtain expertise from anyone willing to help

Scenario: I'm trying to write an upgrade batch file for a software.

The Upgrade requires the followign step
  • Identify old version ....
  • uninstall old version
  • Restart ( Must be done )
  • Install new version
  • Restart (Must be done)

The above steps is to be implimented at windows logon within a domain. So when the user starts the PC, the above steps must be automatically carried out before allowing the user to logon to the PC.

It would be great if someone could assist me in this or provide me with links where I can find similar examples or scenario's .

Thank you very much.
0 Comments   [ - ] Hide Comments


Please log in to comment

Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.
Answer this question or Comment on this question for clarity


A batch file would, IMV, be completely the wrong "tool" to use for this. The best approach would be to create an installation package (MSI) but, if you're not comfortable with that or do not have the necessary skills, then a script would be a better option than a batch file. You would only be able to use crude error-trapping in a batch file, for example and the flow control is excruciating.

Note: reboots are only necessary in a very limited number of circumstances. Generally, vendors are too stupid to program them out of their installers. Investigate further as to why the reboots are taking place and try to eliminate them in your solution.
Answered 03/13/2009 by: VBScab
Red Belt

Please log in to comment
Hello VBScab

I do have a MSI installer provided by the Software.

The Reboot is required as the software installs a service during installation and removes the service when uninstalling.

When I tried upgrading the software using GPO.

The software got and unistalled and installed but the restart got suppressed after the uninstall . Which caused the service to act wierd after install. This is why I need a restart after install and uninstall. To be frank restart is the important part in the deployment.

Note: This problem did not occur in windows Vista as it does not require an restart.

Kind regards

Answered 03/13/2009 by: Pradheep
Yellow Belt

Please log in to comment
Unless the service is a system service (generally speaking, if it appears in the list when you start the MMC plug-in Services.MSC, then it's not a system service), there's no reason whatsoever for a restart. Use the ServiceControl table to start and stop the service.

From the sound of it, you have an MSI supplied by a vendor so you should make any alterations using a transform, rather than editing the MSI directly.
Answered 03/13/2009 by: VBScab
Red Belt

Please log in to comment
I agree with VBS Cab.

If you really not comfortable going with MSI solution you can always write a VB script for uninstallation. In other words, seperate two taks into 2 jobs.
1. Uninstall previous versions - I would prefer using VB script to do this part instead of batch file. Use uninstall string provided by vendor to do this.
2.Install the latest version with vendor install.
Answered 04/12/2009 by: naveenmukka
Yellow Belt

Please log in to comment