Powershell Script when installing MSI and MSP together

Copper Contributor

Hi,

I'm doing an Intune packaging where I have below PowerShell Script when installing MSI and MSP together, however, it installs only msi wondering if something is wrong why MSP is not installing.

$InstallDir = "C:\Program Files\"
$shortcuts = "1"
$reference = "TRIM"

#We can automate and control based on installed features on the pc
$word = "1"
$excel = "1"
$powerpoint = "1"
$outlook = "1"
$project = "0"


$date = ((get-date).ToUniversalTime()).ToString("yyyyMMddThhmmssZ")
$logPath = "C:\TEMP"
$CMlog = $logPath+"\CM_Install_$date.log"
$patchlog = $logPath+"\CM_Patch_Install_$date.log"

New-Item -ItemType Directory -Force -Path $logPath | Out-Null

$cmArg = '/i "'+"$PSScriptRoot"+'\'+'CM_Client_x64.msi" /qn /norestart /l*v "'+"$CMlog"+'" INSTALLDIR="'+"$InstallDir"+'" TRIM_DSK="'+"$shortcuts"+'" TRIMREF="'+"$reference"+'" WORD_ON="'+"$word"+'" EXCEL_ON="'+"$excel"+'" POWERPOINT_ON="'+"$powerpoint"+'" OUTLOOK_ON="'+"$outlook"+'" PROJECT_ON="'+"$project"+'"'
Start-Process "msiexec.exe" -Wait -ArgumentList $cmArg

$patchArg = '/i "'+"$PSScriptRoot"+'\'+'CM_Patch1.msp" /qn /norestart /l*v "'+"$Patch1log"+'"'
Start-Process $file -Wait -ArgumentList $patchArg

$patchArg = '/i "'+"$PSScriptRoot"+'\'+'CM_Patch1H41.msp" /qn /norestart /l*v "'+"$Hotfixlog"+'"'
Start-Process $file -Wait -ArgumentList $patchArg

 

 

4 Replies
What do the logfiles tell you in c:\temp? Perhaps adding a start-transcript c:\temp\install.log at the start and stop-transcript at the end will tell you more?
It looks like there might be a typo in the script. In the line where you're trying to install the MSP file, you have the variable $file instead of $PSScriptRoot.


Try changing this line:

Start-Process $file -Wait -ArgumentList $patchArg


to

Start-Process "msiexec.exe" -Wait -ArgumentList $patchArg

@UmeshVangapalli 

 

You cannot install an MSI and an MSP together. When installing an MSI, only a transform (MST) can be used as part of the installation.

 

An MSP is designed to be run separately after the installation, or against the administrative installation - if one is being used (which is a special type of installation beyond the scope of the question you've asked.)

 

If you provide the parameters for an MSI installation as well as a patch (/update), the patch will simply be ignored.

 

Cheers,

Lain