Running MSIEXEC in a NSIS script with installer switches - installation

I'm trying to build an NSIS installer and package it with necessary drivers (MSI files from the vendor). Eventually, I'd like to install these drivers silently in the backgroud. However, I cannot seem to get it working properly.
In my NSIS script, I have the following:
ExecWait 'msiexec /i "$INSTDIR\Flash.msi INSTALLDIR="$INSTDIR\Drivers\Flash""'
It seems to execute; if I remove the INSTALLDIR switch from the above snippet, it'll run the driver installation as expected. But when I leave it in, I'm instead greeted by the following window
However, running the following directly in Powershell does exactly what I want, sets the install directory appropriately, as expected:
.\Flash.msi INSTALLDIR=".\Drivers\Flash\"
I'm guessing it's a silly quotation-mark mismatch somewhere, but I've tried so many already and I get the same results.

Your doublequote for the .msi path is closed too late.
Use
ExecWait 'msiexec /i "$INSTDIR\Flash.msi" INSTALLDIR="$INSTDIR\Drivers\Flash"'

Have you tried the following:
ExecWait 'msiexec /i "$INSTDIR\Flash.msi INSTALLDIR=$\"$INSTDIR\Drivers\Flash$\""'
or
ExecWait 'msiexec /i "$INSTDIR\Flash.msi INSTALLDIR=$\"$\"$INSTDIR\Drivers\Flash$\"$\""'
Reference: http://nsis.sourceforge.net/Docs/Chapter4.html and take a look at the Strings section under 4.1 Script File Format.
Updated with extra escaped quotes.

Related

InstallShield silent install CR Runtime 13.0.17

Hi, I create a Setup with Installshield 2015. my setup has a prerequisites for reporting viewer so i want to install CR_Runtime13.0.17.msi silently. for this situation we want a command to start the cr_runtime setup silent, after many searches on the net i found this command.
msiexec /i IsSetupPrerequisites\CR_Runtime13\CR_Runtime13.0.17.msi /qb /norestart
when i use this command on Cmd it works well and setup is begins silently with progress bar but when i use this command on installshield, it show me an error and a help every time.
please help me to create a command for installshield to install cr_runtime13.0.17 silently.
at the end i Attached installshield command page and my help to this Question.
Many Thanks to all
The Specify the command line for the application value is really just the arguments. From Specifying Command-Line Parameters for an InstallShield Prerequisite:
Type any valid parameters for the file that is selected in the Specify the application you wish to launch list. Do not include the name of the file in this box.
Remove your inclusion of msiexec and an attempted relative path to the msi, leaving you with just /qb /norestart, and you should avoid the msiexec error. If that one still gives you problems, consider replacing /norestart with REBOOT=ReallySuppress.
I had to create a prerequisite for .net 4.6.1 and it worked silently when I had only /q /norestart in the command line and command line for silent mode.(instead of /qb /norestart)

msiexec does not pass parameters from the command line

I was trying to use MSI installer to install this file myInstaller.msi and also pass the value "192.168.2.1" to IPADDRESS, which is mandatory on the process of installation. However, it comes up an error message "install failed". I checked on Windows, the application is installed, but it's not on Windows Services, where it is supposed to be.
msiexec /i myInstaller.msi IPADDRESS=192.168.2.1
I also have read this link msiexec does not pass parameters to custom action. There is comment saying that installing ORCA and then editing the MSI file, it should work, however, after I have deleted cut row containing CustomTextC_SetProperty_EDIT1, and then saved the MSI file, it seems it's broken, it can not even run, the file is damaged.
Any help for this? I have been working almost 2 days trying to work it out, but can't. :-(
I'll try to answer with a potential quick fix rather than a long explanation:
Open an unharmed copy of the MSI file with Orca
Add to the Property table:
Property column: IPADDRESS Value column: 192.168.2.1
Then add IPADDRESS to the delimited list in SecureCustomProperties. See image below
Save and close, and run the MSI
Open an elevated cmd.exe prompt (search in start menu for cmd.exe, right click and run as administrator)
Install with command line (modify with your own paths): msiexec.exe /I "myInstaller.msi" /QN /L*V "C:\msilog.log"
Check results, and report here what you find. Most likely there is something else wrong, but this will bypass most other error sources.
I do not recommend this approach as anything but a quick test.

Making Any Command in CMD work in a .BAT as an .EXE

Redirecting CMD Commands To An EXE File
Long story short, basically I have the problem that every time I run BCDedit on the .BAT that I converted into an .EXE it never worked and I thought that the reason why it wasn't work was because it wasn't on Path but my Path was fine and even if it was on Path is set by default thanks to foxidrive.
Now my main problem is that is there a way I can convert it to an .EXE file with every single command working, is there a technique I could use to get BCDedit working as an .EXE file?
All of the commands do work it just BCDedit and I say if every single command would work so if somebody has a similar command problem like me they know how to figure it out, it works perfectly as batch but is there a way I can convert it and make BCDedit still work as an .EXE?
Please answer As Soon As Possible and if you want to take a look at my Path and Batch the visit the link at the top.
Thank you so much!
Compile this batch file and see if it works:
#echo off
bcdedit /?
pause
Then try this version:
#echo off
c:\Windows\System32\bcdedit.exe /?
pause
Just as the SysWow64 Redirection link you listed states. If you want a x86 application to call the 64-bit system directory you need to call the bcdedit application as follows.
%SystemRoot%\SysNative\bcdedit
This is because of Windows backwards compatibility measures, it is looking at C:\Windows\SysWOW64 instead of C:\Windows\System32. Another alternative would be to compile the script as both x86 and 64-bit, but then you could only use each on the respective systems.
Update for Comments
Even though the path is correct, an x86 application will execute commands or batch scripts against the C:\Windows\SysWOW64\cmd.exe which will cause the path redirection issue. Example to illustrate my point. On a 64-bit version of Windows, open C:\Windows\SysWOW64\cmd.exe and using Windows explorer create two unique files , one is C:\Windows\System32\unique_test64.txt and the other in C:\Windows\SysWOW64\unique_test86.txt. Now on the x86 command prompt enter if exist C:\Windows\System32\unique_test86.txt echo true. You will see that it is being redirected to SysWOW64 and will print true. And if you enter if exist C:\Windows\System32\unique_test64.txt echo true, nothing will be found.
Screenshot Example: http://i.imgur.com/K4kkI29.png

How to set up answer file/.ini for WinZip installer using NSIS

I am creating an installer that installs several programs and file packages at once, one of these being WinZip, I want the WinZip installer to run in the background, from what I've gathered using /s will make it run in silent mode, BUT the installer still doesn't install. I believe that is because of the selections one must make during the WinZip installation process. so my question is how could I set this up to silently install WinZip in the background? would I need an Answer file? if so how do I get that set-up? any help would be great!
*snippet of my code in the NSIS file:
Section
IfFileExists "C:\Program Files\WinZip\WINZIP32.EXE" Dont_Install
SetOutPath $TEMP
File "Installerfiles\WinZip165.exe"
DetailPrint "Starting Winzip installation"
ExecWait "/s WinZip165.exe"
Delete $TEMP\WinZip165.exe
SetOutPath $INSTDIR
Goto done
Dont_Install:
MessageBox MB_OK "You seem to have this program \
(WinZip) already installed"
done:
SectionEnd
*note I have seen the other questions on having a silent install, this question is more WinZip specific and pertaining to how I would establish an answer file if need be.
ExecWait "/s WinZip165.exe" is clearly wrong, it should be ExecWait '"$TEMP\WinZip165.exe" /S' but I don't think WinZip uses a NSIS based installer...
They do offer a .MSI, you might want to take a look at that. Their knowledgebase contains some useful tips like this and this. You can also find some other tips by googling...
If you have any other questions about their silent install mode you should probably contact WinZip support.
Since I can't comment on Anders response because I don't have enough reputation yet, here is the command that I personally use to silently install msi installers, copied right from an installer I have used several times when I want to install multiple programs.
ExecWait '"msiexec" /i "$TEMP\MSI Installer.msi" /qn'
This is assuming that you take Anders advice and try to use the msi version of WinZip.
Also Anders mentions one of the errors in your code where you don't use a full path to the installer you are trying to run. I also wanted to note that it is always a good idea to wrap your paths in single quotes. For example when you do:
Delete $TEMP\WinZip165.exe
Add single quotes like so:
Delete '$TEMP\WinZip165.exe'
This also applies when you do your
SetOutPath '$TEMP'
and
SetOutPath '$INSTDIR'
While you can get away most cases without the single quotes, if you ever come across a path that has spaces in it, it will give you headaches if you are trying to pass the path to a macro or something because it delimits on the spaces and breaks the string into multiple pieces. It is just a good habit to get into whenever you are dealing with Windows Paths that may or may not have spaces.
BTW don't accept this answer, I intended it to just be a follow-up to what Anders had already said.

Installshield Silent Uninstall not working at Command Line

We have an older app from 2006 we'd like to uninstall at the command line using group policy, but I can't get a silent uninstall to work.
This works. Of course I need to click Next to uninstall:
"C:\App\Setup.exe" /uninst
But this does not. I see an hourglass for a couple seconds but the app is not uninstalled.
"C:\App\Setup.exe" /uninst /s
I also unsuccessfully tried some VBScripts. They find the app listed but the uninstall fails. I'm not too familiar with how this process is supposed to work.
You need to create first an ISS response file to silently remove your application,
Create response file :
C:\App\Setup.exe /r /f1c:\app\uninstall1.iss
you will be asked to uninstall, .... and perhaps reply the others windows.
Then your application would be uninstalled and you get a new response file c:\app\uninstall1.iss
Next, if you want to remove silently this application on another computer :
launch : C:\App\Setup.exe" /s /f1c:\app\uninstall1.iss
For more information see:
http://www.itninja.com/blog/view/installshield-setup-silent-installation-switches
Best Regards,
Stéphane
Try this, with the original setup.exe version that was used to install
"C:\App\Setup.exe" /x /s /v/qn
I've been struggling with the silent uninstaller for a while, and finally came to a solution that works for me in most cases, both for InstallShield v6 and v7.
1. First (as it was mentioned above), you have to generate an InstallShield Response file (e.g. uninstall.iss). In order to do that you have to launch your setup.exe with parameters:
> setup.exe -x -r -f1"C:\Your\Installer\Location\uninstall.iss"
This will go through the normal uninstall wizard and generate a Response file for you: uninstall.iss
2. Then, before trying your silent uninstaller, I guess, you should re-install the software.
3. And finally, run your silent uninstaller playing back the recently generated Response file:
> setup.exe -x -s -l0x9 -ARP -f1"C:\Your\Installer\Location\uninstall.iss"
That's it.
Now, a few important notes:
Note 1: I'm working with a 3-rd party installation package that I didn't build myself.
Note 2: I use dashes (-) instead of slashes (/) to define parameters. For some reason it doesn't work with slashes for me. Weird but true.
Note 3: The -ARP and -l switches are required for some installation packages to manage the software removal from the Add/Remove Programs list and to preset the default input language accordingly.
Successful silent uninstallation is all about the correct parameters!
So keep exploring, the correct parameters vary depending on a specific package and installer version.
I hope my input was helpful.
Try
Format: Setup.exe M{Your Product GUID} /s /f1[Full path]\*.iss for creating the ISS file for uninstallation.
From Stephanie's sample, I think it's missing the GUID.
There's a good link at the developer's site # Creating the Response File.
Try it out n tell us,
Tommy Kwee
I struggled with this for a long time so posting it here in case anybody else stumbles upon it.
If you happen to have an installer which uses the legacy Package-For-The-Web format then you need to use the parameter -a to pass additional parameters to the extracted setup file.
Record (un)installation files (click through the installer manually):
.\DWG2PDF2019.exe -a /r /f1"c:\app\dwg2019_install.iss"
.\DWG2PDF2019.exe -a /r /f1"c:\app\dwg2019_uninstall.iss"
Silently (un)install:
.\DWG2PDF2019.exe -s -a /s /f1"c:\app\dwg2019_install.iss"
.\DWG2PDF2019.exe -s -a /s /f1"c:\app\dwg2019_uninstall.iss"
Source: https://help.hcltechsw.com/caa/3.0/topics/appacc_silent_install_t.html
There's another way to uninstall an app by searching for it in the Registry, and using the UninstallString (this sample code uses powershell on windows 10):
# Get all installed apps from Registry
$Apps = #()
$Apps += Get-ItemProperty "HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\*" # 32 Bit
$Apps += Get-ItemProperty "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\*" # 64 Bit
# Uninstall My App
$my_app = $Apps | Where-Object{$_.DisplayName -eq "The Name Of My App"}
$uninstall_string = " /C " + $my_app.UninstallString+' /S'
Start-Process -FilePath "cmd.exe" -ArgumentList $uninstall_string -Wait
if you don't know the exact full display name of your app, you can print the "Apps" array to a file, and search there:
$Apps | Out-File C:\filename.txt
I was working on a silent uninstall of an InstallShield installer and was running into similar issues. What was posted here did not work or help. After lots and lots of trial and error I did find that for some reason when I used the -uninst option for both the creating the response file and running the silent uninstall I had success. In case anyone runs into a similiar issue and stumbles upon this thread I wanted to share. I am not sure why but adding -uninst did change the contents of the response file.
In my example creating response file: "C:\Program Files (x86)\InstallShield Installation Information\{0D20ACF2-CEE1-4523-BFCF-389BC4CC81FB}\setup.exe" -runfromtemp -l0x0409 -removeonly -uninst -r -f1"c:\uninstall.iss"
Then I could finally get the silent uninstall to function as expected: "C:\Program Files (x86)\InstallShield Installation Information\{0D20ACF2-CEE1-4523-BFCF-389BC4CC81FB}\setup.exe" -runfromtemp -l0x0409 -removeonly -uninst -s -f1"c:\uninstall.iss"

Resources