Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

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

Posted on 2009-05-08
5
Medium Priority
?
779 Views
Last Modified: 2013-11-14
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
Comment
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
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 13

Expert Comment

by:Brum07
ID: 24336722
See below

replace the notepad.exe with your setup exe
option explicit
on error resume next
Msgbox "Your Message"
Dim WshShell
Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.Run "c:\windows\system32\notepad.exe"

Open in new window

0
 
LVL 13

Expert Comment

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

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

Author Comment

by:automaton64
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
Msgbox "Your Message"
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"""

Open in new window

0
 
LVL 12

Accepted Solution

by:
zoofan earned 1000 total points
ID: 24341494
Copy and paste into notepad

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)

Open in new window

0
 

Author Closing Comment

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

Featured Post

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.

Question has a verified solution.

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

Among others, I monitor the Windows Installer zone and Installer zone. I find that many of the questions could be answered much more quickly if a Windows Installer verbose log were submitted with the question.   However, I do not always have t…
I have been scripting applications way too long and can never remember how to create an ISS file.  So I decided to write this article to act as my own knowledge base for future reference, and hope you will also benefit. An ISS file is a response …
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…

636 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