MSI Path errors pushed with SCCM 2007

Running this script manually works without any issue but on certain machines it fails with a $Path error. The odd thing is it only happened on 5 out of 16 machines; 11 machines ran successfully.

##===============================================
##
INSTALLATION
##*===============================================
[string]$installPhase = ‘Installation’

	## Handle Zero-Config MSI Installations
	If ($useDefaultMsi) { Execute-MSI -Action 'Install' -Path $defaultMsiFile }
	
	## <Perform Installation tasks here>
	# Certificate Installer
	#Execute-Process -Path "SunGard.PS.WCF.Certificate.Installer.exe" -Parameters  '/qn /hide_splash' -WindowStyle Hidden
    
    # SQL Clr Types x64 install
    If ($envOSArchitecture -eq "64-bit")
    {
    Write-Log -Message "x64 OS detected"
    Execute-MSI -Action Install -Path 'SQLSysClrTypes_x64.msi' -Parameters '/QN'
    }
    #SQL Clr Types x86 install
    If ($envOSArchitecture -eq "32-bit")
    {
    Write-Log -Message "x86 OS detected"
    Execute-MSI -Action Install -Path 'SQLSysClrTypes_x86.msi' -Parameters '/QN'
     }

    # Report Viewer 2012 install
    Execute-MSI -Action Install -Path 'ReportViewer2012.msi' -Parameters '/QN'

Error log

[Installation] :: Function failed, setting exit code to [60002]. 
Error Record:
-------------

Message        : [msiexec.exe] contains an invalid path or file name.
InnerException : 

FullyQualifiedErrorId : [msiexec.exe] contains an invalid path or file name.

PositionMessage : 
                  At C:\Windows\SysWOW64\CCM\Cache\CC1001EA.5.System\AppDeployT
                  oolkit\AppDeployToolkitMain.ps1:2362 char:11
                  +                     Throw <<<<  "[$Path] contains an invali
                  d path or file name."

What version of the toolkit are you using? It looks like the toolkit failed to find the fully qualified path to msiexec.exe in function Execute-Process. The code that does this is at the very start of the function. I would suggest copying this portion of the code out of the function and testing it by itself on the PC generating the error to see if you can identify what the problem might be.

I would also suggest changing the -ErrorAction behaviour for this line to ‘Stop’ instead of ‘SilentlyContinue’. That might show us details for some error that may be getting suppressed:

[string]$FullyQualifiedPath = Get-Command -Name $Path -CommandType 'Application' -TotalCount 1 -Syntax -ErrorAction 'SilentlyContinue'

This script started off using 3.6.3 once I ran into this issue I created it again using 3.6.4 to see if the issue followed. So right now I am using 3.6.4. I did as you suggested and it looks like it is an msiexec issue

I am trying to find one of the failing machines to see what I can figure out. Last night I remoted to one of the failed machines and when deploy-application.exe was ran locally it ran successfully.

[Installation] :: Function failed, setting exit code to [60002].
Error Record:

Message : The term ‘msiexec.exe’ is not recognized as the name of a cmdl
et, function, script file, or operable program. Check the spel
ling of the name, or if a path was included, verify that the p
ath is correct and try again.
InnerException :

FullyQualifiedErrorId : CommandNotFoundException,Microsoft.PowerShell.Commands.
GetCommandCommand

PositionMessage :
At C:\Windows\SysWOW64\CCM\Cache\CC1001EA.6.System\AppDeployT
oolkit\AppDeployToolkitMain.ps1:2352 char:46
+ [string]$FullyQualifiedPath = Get-Command <
<<< -Name $Path -CommandType ‘Application’ -TotalCount 1 -Sy
ntax -ErrorAction ‘Stop’

The line where your error is occuring uses the Get-Command cmdlet to search the Path environment variable ($env:path) to find the fully qualified path of a file when a fully qualified path is not provided. Check the path environment variable on machines throwing an error to see if it is configured properly.

That is the path I started looking into also. The odd thing is I’m not seeing any obvious issues on the first machine.

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment]
C:\ProgramData\Oracle\Java\javapath;
%SystemRoot%\system32;
%SystemRoot%;
%SystemRoot%\System32\Wbem;
%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;
C:\Program Files (x86)\Common Files\LaserFiche\System;
C:\Program Files\SunGard\bin

.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC

Yeah, I don’t see any issue with that either.

Turns out even though they looked ok the registry entry was a REG_SZ entry instead of a REG_EXPAND_SZ somehow. I fixed that reboot and pushed the install again and it succeeded like normal.

Thanks for helping me look down the right path (no pun intended) Muhammad!