Forum Discussion
vetadmin
Jul 28, 2022Copper Contributor
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 -Fil...
- Jul 29, 2022
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
LainRobertson
Jul 29, 2022Silver 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
vetadmin
Aug 03, 2022Copper Contributor
Hi 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?
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?