Solved

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

Posted on 2009-05-08
5
759 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
  • 2
  • 2
5 Comments
 
LVL 13

Expert Comment

by:Brum07
Comment Utility
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
Comment Utility
to run the MSi you can use the below;

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

Author Comment

by:automaton64
Comment Utility
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 250 total points
Comment Utility
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
Comment Utility
Yes.  This is just what I need. Thank you.
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Vbscript 8 65
Customize & Tweak Windows 10 Installation 14 36
Need help editing script 3 49
Active Directory Audit 18 69
I met Paul Devereux (@pdevereux) today when I responded to his tweet asking “Anybody know how to automate adding files from disk to a folder in #outlook  ?”.  I replied back and told Paul that using automation, in this case scripting, to add files t…
This article is the result of a quest to better understand Task Scheduler 2.0 and all the newer objects available in vbscript in this version over  the limited options we had scripting in Task Scheduler 1.0.  As I started my journey of knowledge I f…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

762 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

Need Help in Real-Time?

Connect with top rated Experts

7 Experts available now in Live!

Get 1:1 Help Now