Jump to content

Updating via MSI via Batch - detecting version number of current EXE version


Recommended Posts

Posted

On our machines we have Software ABC v1.0, installed under c:\program files\abc

 

Now the supplier has sent us an updated v1.2 version to deploy

 

They have supplied the v1.2 MSI and I have placed this in a simple batch file to run at shutdown / restart via Group Policy

 

This works great with 'if exist' statements (e.g. if exist c:\program files\abc\abc.exe then continue to the update step of the batch file, if not just exit out)

 

The issue is this would then run at every shutdown / restart, but it only needs to be run once if the older version is installed (in fact updating more than once is a big problem as it resets a connection string file each time!)

 

Now if I look at the file properties of abc.exe in Windows it helpfully reports a version number, so what is the easiest way to extend my batch file to detect this version number?

 

Also I have another issue in it has a different installer for 32bit/64bit so if I could also extend my batch file to detect platform that would be great although I have other ideas on how to get around that!

Posted

To be honest unless you really want to check version number you could just do a file check and write like a “updated.txt” into said location

 

Again unless you really want to get into os versions just check if x86 programs exist as it’ll be 64 then etc

 

If you want it to check let me know as I have an old script that did it somewhere but stopped using it as going the above easier to use on multiple programs and os versions etc

 

Steve

  • Thanks 1
Posted

In the end I used GPP to create a text file based on EXE version number conditions, and another condition to create a slightly differently named text file if x64 ('if c:\program files (x86) exists')

 

I then fed the text file names into the batch file and all working well, once the new version is installed a seperate GPP entry then in place to remove the text file again based on EXE version number :)

 

Pity there isn't group policy conditions for startup/shutdown scripts to begin with as that would make it even easier!

Posted
You can pull the version of a file with PowerShell

I was going to suggest the same thing. :)

 

Personally I would have done the whole script in PowerShell. It's much easier to do most things compared to batch files.

  • Thanks 2

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...