• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 364
  • Last Modified:

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."


0
Habib Zakaria
Asked:
Habib Zakaria
  • 3
  • 3
1 Solution
 
RobSampsonCommented:
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
 
Habib ZakariaNetwork Solutions ArchitectAuthor Commented:
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
 
RobSampsonCommented:
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
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
Habib ZakariaNetwork Solutions ArchitectAuthor Commented:
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
 
RobSampsonCommented:
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
 
Habib ZakariaNetwork Solutions ArchitectAuthor Commented:
Excellent
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Certified Penetration Testing

This CPTE Certified Penetration Testing Engineer course covers everything you need to know about becoming a Certified Penetration Testing Engineer. Career Path: Professional roles include Ethical Hackers, Security Consultants, System Administrators, and Chief Security Officers.

  • 3
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now