Solved

# I need a VBscript to run an msi after clicking on an ok button.

Posted on 2009-05-08
Medium Priority
777 Views
I need a VBscript to run an msi after clicking on an ok button.  I need our users to see a message that will inform them to close a program before they click an ok button and install runs.  I have the msi working but I am just learning VB scripting.  Thanks.
0
Question by:automaton64
[X]
###### Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

• Help others & share knowledge
• Earn cash & points
• 2
• 2

LVL 13

Expert Comment

ID: 24336722
See below

option explicit
on error resume next
Dim WshShell
Set WshShell = WScript.CreateObject("WScript.Shell")

0

LVL 13

Expert Comment

ID: 24336740
to run the MSi you can use the below;

WshShell.Run "c:\windows\system32\msiexec /i ""program.msi"" /qn"
0

Author Comment

ID: 24338865
This is great.  Thank you. However, when I am testing it out with my msi which uses a transform file nothing seems to happen after the message window.  Here is what I am trying.
option explicit
on error resume next
Dim WshShell
Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.Run "C:\ln85\msiexec /i ""Lotus Notes 8.5.msi"" TRANSFORMS=""Lotus Notes 8.5.mst"""

0

LVL 12

Accepted Solution

zoofan earned 1000 total points
ID: 24341494

Edit line 8 to the name of the app to close
Edit line 9 to the full command line for the msi install

save as filename.vbs

run it.

zf
Option Explicit
Dim WshShell
Dim Intresult
Dim strAppName
Dim strCommand

strAppName = "TheApptoClose" ' edit thename of the app you want the user to close.
strCommand = "msiexec.exe /i \\server\share\NameOf.msi" 'edit to the command line to execute the msi.

Intresult = MsgBox("Please close " & strAppName & " before installing this application.",vbOKCancel,"MSI installation")

If Intresult = vbOK Then
Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.Run strCommand,1,True
Else
MsgBox "The installation has been cancelled",vbOKOnly,"MSI Installation"
End If
WScript.Quit(0)

0

Author Closing Comment

ID: 31579478
Yes.  This is just what I need. Thank you.
0

## Featured Post

Question has a verified solution.

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

One of the frequent problems with the installations is when some file or registry entry is not removed from the system upon un-installation of the product. Clean removal is always highly desirable. One major reason for that is badly authored inst…
Deploying a Microsoft Access application in a Citrix environment is not difficult but takes a few steps. However, Citrix system people are often of little help, as they typically know next to nothing about Access. The script provided here will take …
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
###### Suggested Courses
Course of the Month11 days, 14 hours left to enroll