MSIExec not working from script - Advanced Installer Community
jusher
Posts: 195
Joined: Thu Dec 22, 2011 12:00 pm

MSIExec not working from script

Hi,
I have a problem where if I run MsiExec /x{47D90718-5075-4804-ABA2-50F5D654A904} /qn from the command line it works.
If I run the same via a deferred VBscript (selected 64 bit, run under Local System Account with full privileges and wait for script to finish) it doesn't remove the program. I am running on a 64 bit Windows Server 2012 R2.

I pass in the properties to a deferred custom action through CustomActionData.

Any idea why?

Regards,
John

The script is reproduced below: -
'strText = Session.Property("CustomActionData")

The APPDIR and ProductCode variables are set to what is received from this, I have checked that they are populated with valid strings.

strFilePath = strAPPDIR & "msiexec64.exe /x" & strProductCode & " /log C:\TEMP\ju.log /qn"
Run strFilePath, strAPPDIR

Sub Run(strFile, strWorkingDirectory)
Dim shell
Const cDebug = True
If cDebug=True Then
MsgBox "Run: strFile = " & strFile
End If

Set shell = CreateObject("WScript.Shell")
shell.CurrentDirectory = strWorkingDirectory
' Now run the command 0 = Hide the window and activate another window
' False = immediately returns to script execution rather than waiting
' on the process termination (and returns an error code of 0).
' We need to wait for it to execute because we are actually deleting the
' executable as the next operation so set parameter to True.
' See http://ss64.com/vb/run.html
If cDebug = False Then
shell.Run strFile, 0, True
Else
'1 Activate and display the window. (restore size and position) Specify this flag when displaying a window for the first Time
shell.Run strFile, 1, True
End If
Set shell = Nothing
End Sub
Daniel
Posts: 8283
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: MSIExec not working from script

Hello John,

You can see my reply on the "I need a self removing MSI" thread.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”