Forum Discussion
Start-process launches windows installer
I think there is something I am missing that when I try to run the installer for an msp file and using this syntax it stops and brings the windows installer window.
Start-Process msiexec.exe -FilePath "$Installdir\AcrobatDCx64Upd2200120169.msp" -ArgumentList "/sAll /rs /rps /msi /norestart /quiet EULA_ACCEPT=YES"
Am I missing something?
You've provided the parameters incorrectly.
First, here's the commandlet's reference article:
Next, here are the issues from your command line:
- You have placed msiexec.exe on its own when it should follow the "-FilePath" parameter;
- The -FilePath parameter is pointing to the MSP file when it should be referring to msiexec.exe;
- The MSP file should be after msiexec's "/p" parameter;
- There is no "/p" parameter;
- The argument list is supposed to be an array of strings but you have a single string containing all parameters. Most of the time you can actually get away with this for traditional DOS-style commands (as msiexec.exe is) but it's not in line with how -ArgumentList should be used and will break in many PowerShell scenarios where it can be more fussy about such things.
So, what should the command look like? (noting that I haven't not bothered checking the validity of the msiexec.exe parameters)
Start-Process -FilePath msiexec.exe -ArgumentList @("/p", "$Installdir\AcrobatDCx64Upd2200120169.msp", "/sAll", "/rs", "/rps", "/msi", "/norestart", "/quiet EULA_ACCEPT=YES");
Cheers,
Lain
- LainRobertsonSilver Contributor
You've provided the parameters incorrectly.
First, here's the commandlet's reference article:
Next, here are the issues from your command line:
- You have placed msiexec.exe on its own when it should follow the "-FilePath" parameter;
- The -FilePath parameter is pointing to the MSP file when it should be referring to msiexec.exe;
- The MSP file should be after msiexec's "/p" parameter;
- There is no "/p" parameter;
- The argument list is supposed to be an array of strings but you have a single string containing all parameters. Most of the time you can actually get away with this for traditional DOS-style commands (as msiexec.exe is) but it's not in line with how -ArgumentList should be used and will break in many PowerShell scenarios where it can be more fussy about such things.
So, what should the command look like? (noting that I haven't not bothered checking the validity of the msiexec.exe parameters)
Start-Process -FilePath msiexec.exe -ArgumentList @("/p", "$Installdir\AcrobatDCx64Upd2200120169.msp", "/sAll", "/rs", "/rps", "/msi", "/norestart", "/quiet EULA_ACCEPT=YES");
Cheers,
Lain
- vetadminCopper ContributorHi Thanks Lain for the correction
This is what I have written
# Check if Software is installed already in registry.
$CheckADCReg = Get-ItemProperty HKLM:\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\* | where {$_.DisplayName -like "Adobe Acrobat Reader DC*"}
# If Adobe Reader is not installed continue with script. If it's istalled already script will exit.
If ($CheckADCReg -eq $null) {
# Path for the temporary downloadfolder. Script will run as system so no issues here
$Installdir = "c:\temp\install_adobe"
New-Item -Path $Installdir -ItemType directory
# This is a 32 bit install version. Use the same 64 bit version file.
# Download the installer from the Adobe website. Always check for new versions!!
$source = "\\company.local\Share\\Software\Adobe\Acrobat\Patch\AcrobatDCx64Upd2200120169.msp"
$destination = "$Installdir\AcrobatDCx64Upd2200120169.msp"
Invoke-WebRequest $source -OutFile $destination
# Start the installation when download is finished
#Start-Process msiexec.exe -FilePath "$Installdir\AcrobatDCx64Upd2200120169.msp" -ArgumentList "/sAll /rs /rps /msi /norestart /quiet EULA_ACCEPT=YES"
#The above syntax is what I had and I added yours below
Start-Process -FilePath msiexec.exe -ArgumentList @("/p", "$Installdir\AcrobatDCx64Upd2200120169.msp", "/sAll", "/rs", "/rps", "/msi", "/norestart", "/quiet EULA_ACCEPT=YES");
# Wait for the installation to finish. Test the installation and time it yourself. I've set it to 240 seconds.
Start-Sleep -s 240
# Finish by cleaning up the download. I choose to leave c:\temp\ for future installations.
rm -Force $Installdir\AcroRdrDC*
}
Does this look ok? - vetadminCopper Contributor
LainRobertson Hi Lain,
Thanks for the correct format. I know the installdir is not specified
$Installdir=""
Start-Process -FilePath msiexec.exe -ArgumentList @("/p", "$Installdir\ndp48-x86-x64-allos-enu.exe", "/sAll", "/rs", "/rps", "/msi", "/norestart", "/quiet EULA_ACCEPT=YES");I still get the msiexec popup
- LainRobertsonSilver Contributor
Yeah, that makes sense as a good number of those parameters do not relate to msiexec.exe at all which is what's causing the msiexec help box to appear.
My guess is those options relate to the Acrobat product, not msiexec, in which case trying to pass them as switches (which is anything where the first character is the forward slash) will continue to cause the help box to appear.
If they're defined as properties within the base MSI or the MSP, then you just need to remove the leading forward slash. If they're not properties, then you would be best to use Adobe Reader customisation wizard:
- Customisation landing page: Deploy Adobe Acrobat DC
- Customisation wizard download: Installation and setup — Acrobat Customization Wizard for Windows (adobe.com)
Until you sort out the bad parameters, you'll keep seeing that help dialog windows popping up. It's not a problem with Start-Process or PowerShell in this case.
PS: I got curious just before hitting post and had a read of Adobe's command line examples, and it's very misleading.
Near the top under the heading of "MSI usage", there is a table where your "/sAll" parameter is listed, so I can see why you are trying these parameters directly against msiexec.exe. However, many of the switches in this table do not relate to msiexec.exe at all, but rather the Adobe bootstrapper (which is mentioned in the description after the heading but you can very, very easily miss the significance of what that means.)
So, the following parameters will not work with msiexec.exe the way you're doing it now. They're intended to be included in the setup.ini instead, when using that .ini file in conjunction with the Adobe bootstrapper:
- sAll
- rs
- rps
- msi
Honestly, just use the Reader customisation wizard to make the relevant changes - ideally as a transform (MST file specified using the TRANSFORMS= property as a parameter - see below). You can save the modified MSI or MSP directly but that's bad practice.
Anyhow, none of this has anything to do with your PowerShell, which is already structured just fine.
Cheers,
Lain