Link to home
Start Free TrialLog in
Avatar of smart Z
smart Z

asked on

VB Script to Remove Old Version of Software and Run Installation

I would like to have a vbscript that will apply the first two commands to remove old version of softwares and run installation afterward.

MsiExec.exe /X{CF5E6448-70F9-4BE1-B1F9-D14DB4872C55} /QN /NORESTART

MsiExec.exe /X{F48F2DD4-DE70-4C4C-A20D-FCF771FAA717} /QN /NORESTART
Set objShell = CreateObject("WScript.Shell")

objShell.Run "Setup_PT.exe /s /v/qn", 1, False

MsgBox "Please note that your computer is in the process of receiving PT 2010 and will reboot. This is part of an update for all the engineers who have PT8.For any questions with regard to this update please contact the helpdesk."


Avatar of RobSampson
RobSampson
Flag of Australia image

Hi there, give this a try.

Regards,

Rob.
' Wait for three minutes before doing anything
WScript.Sleep 180000
Set objShell = CreateObject("WScript.Shell")
objShell.Run "MsiExec.exe /X{CF5E6448-70F9-4BE1-B1F9-D14DB4872C55} /QN /NORESTART", 1, True
objShell.Run "MsiExec.exe /X{F48F2DD4-DE70-4C4C-A20D-FCF771FAA717} /QN /NORESTART", 1, True
objShell.Run "Setup.exe /S /v/qn", 1, False
MsgBox "Please note that your computer is in the process of receiving Adapt PT 2010and it will prompt you to reboot shortly. This is part of an overall update for all the engineers who have Adapt PT8.  For any questions with regard to this update please contact the service  and assign a ticket."

Open in new window

Avatar of smart Z
smart Z

ASKER

RobSampson,
The script is good but just want to confirm these.

Do you know if SMS will miss any of the commands during the advertisement? I had one PC which I advertised a similar script bu the uninstall of the old programs did not happen but it did install the new program.

So not sure what happen. if I apply the script manually on the desktop it works fine.

Thanks,
It shouldn't miss any, but if the product doesn't exist, or has a different product ID, it won't uninstall it.  Also make sure the advertised script is running with Admin credentials.  Maybe if it's configured to run as the local SYSTEM account it won't work either....depends on the product, and the location of the installation source.

Regards,

Rob.
Avatar of smart Z

ASKER

Yes I made sure the product with the same product ID is installed on the test desktop. I am not sure why it miss to remove the old version but the script is working fine.

Many thanks for your help and support.
ASKER CERTIFIED SOLUTION
Avatar of RobSampson
RobSampson
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of smart Z

ASKER

Excellent