?
Solved

VB Script to Remove Old Version of Software and Run Installation

Posted on 2011-04-25
6
Medium Priority
?
361 Views
Last Modified: 2012-05-11
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."


0
Comment
Question by:Habib Z
  • 3
  • 3
6 Comments
 
LVL 65

Expert Comment

by:RobSampson
ID: 35472684
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

0
 

Author Comment

by:Habib Z
ID: 35480091
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,
0
 
LVL 65

Expert Comment

by:RobSampson
ID: 35480110
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.
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 

Author Comment

by:Habib Z
ID: 35483003
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.
0
 
LVL 65

Accepted Solution

by:
RobSampson earned 2000 total points
ID: 35487974
You should be able to use the MSIExec logging feature to determine why it might be failing.  Try this code, then look at the log files afterwards.

I'm not sure if your setup.exe supports logging as well, but it might be same switches as msiexec, so you could try adding logging to that too if you wanted to.

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 /L* C:\Temp\Product1Uninstall.log", 1, True
objShell.Run "MsiExec.exe /X{F48F2DD4-DE70-4C4C-A20D-FCF771FAA717} /QN /NORESTART /L* C:\Temp\Product2Uninstall.log", 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

0
 

Author Closing Comment

by:Habib Z
ID: 35501183
Excellent
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

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

Not long ago I saw a question in the VB Script forum that I thought would not take much time. You can read that question (Question ID  (http://www.experts-exchange.com/Programming/Languages/Visual_Basic/VB_Script/Q_28455246.html)28455246) Here (http…
When you see single cell contains number and text, and you have to get any date out of it seems like cracking our heads.
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
When cloud platforms entered the scene, users and companies jumped on board to take advantage of the many benefits, like the ability to work and connect with company information from various locations. What many didn't foresee was the increased risk…
Suggested Courses

864 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