I am trying to install a VOIP client using a powershell script. When I run the powershell script on the client in a administrative powershell prompt the script runs fine and it installs the application as expected. When I try to do the same thing through the SCCM client using an application it does not install.
I am not a Powershell Guru so the script below is my simple understanding of installations through powershell as of this moment
<# Installatiescript CIC Client SU6 32 bit (kantoor) Versie 1.3 17 april 2015 - Uitbreiding logfile. Fix opschonen startmenu 16 april 2015 - Aanpassing verwijderen oude client, logfile aanmaken in TEMP 13 maart 2015 - Eerste versie #> # Bepaal installatiebron $SourceDir = "\\VSC0501\SetupShare\APP_IC_Client_SU6\x86" # Bepaal logvariabelen $logfile = "$env:TEMP\cic_su6-install.txt" $Logdate = get-date -f yyyyMMdd-HHmm # Controleer of oude CIC client aanwezig is (versie 4.04.316) en deinstalleer deze indien nodig If (Test-Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{543BE3AC-426D-4FDD-8160-ECEEC2E211B6}") { $val = (Get-ItemProperty "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{543BE3AC-426D-4FDD-8160-ECEEC2E211B6}").DisplayVersion if($val -eq "4.04.316") { $process = Start-Process -Filepath "msiexec.exe" -Argumentlist "/x {3F20671C-9CA2-41FA-B94A-C7C7FD95C7B4} /QN" -Wait -Passthru if ($process.ExitCode -eq 0) { Write-Output "$logdate - Client has been succesfully removed" | out-file $logfile -Append } else { Write-Output "$logdate - Client cannot be succesfully removed" | out-file $logfile -Append exit } $process = Start-Process -Filepath "msiexec.exe" -Argumentlist "/x {543BE3AC-426D-4FDD-8160-ECEEC2E211B6} /QN" -Wait -Passthru if ($process.ExitCode -eq 0) { Write-Output "$logdate - Client has been succesfully removed" | out-file $logfile -Append } else { Write-Output "$logdate - Client cannot be succesfully removed - " $process.ExitCode | out-file $logfile -Append exit } #(Start-Process -Filepath "msiexec.exe" -Argumentlist "/x {3F20671C-9CA2-41FA-B94A-C7C7FD95C7B4} /QN" -Wait -Passthru).exitcode #(Start-Process -Filepath "msiexec.exe" -Argumentlist "/x {543BE3AC-426D-4FDD-8160-ECEEC2E211B6} /QN" -Wait -Passthru).exitcode Get-ChildItem "$env:SYSTEMDRIVE\ProgramData\Microsoft\Windows\Start Menu\Programs\Abvakabo FNV\Interactive Intelligence" | Remove-Item -Recurse Remove-Item -Path "$env:SYSTEMDRIVE\ProgramData\Microsoft\Windows\Start Menu\Programs\Abvakabo FNV\Interactive Intelligence" -Recurse -Force } } else { Write-Output "$logdate - Client not present" | out-file $logfile -Append } # Installeer CIC Client SU6 $Arguments = "/i `"$SourceDir\ICUserApps_32bit.msi`" /l*vx `"$env:TEMP\cic_su6.log`" TRANSFORMS=`"$SourceDir\Kantoor.mst`" PATCH=`"$SourceDir\ICUserApps_32bit_SU6.msp`" ICSERVERNAME=cic.abvakabofnv.local /QN /norestart" $process = Start-Process -Filepath "msiexec.exe" -Argumentlist "$Arguments" -Wait -Passthru if ($process.ExitCode -eq 0) { Write-Output "$logdate - CIC Client SU6 (kantoor) has been succesfully installed" | out-file $logfile -Append } else { Write-Output "$logdate - CIC Client SU6 (kantoor) cannot be succesfully installed - " $process.ExitCode | out-file $logfile -Append exit } # Installeer CIC Client SU6 NL Language Plugin $Arguments = "/i `"$SourceDir\LanguagePlugins\ICUserApps_LanguagePlugin_nl.msi`" /l*vx `"$env:TEMP\cic_su6_nl.log`" PATCH=`"$SourceDir\LanguagePlugins\ICUserApps_LanguagePlugin_nl_SU6.msp`" /QN /norestart" $process = Start-Process -Filepath "msiexec.exe" -Argumentlist "$Arguments" -Wait -Passthru if ($process.ExitCode -eq 0) { Write-Output "$logdate - CIC Client SU6 Languagepack NL has been succesfully installed" | out-file $logfile -Append } else { Write-Output "$logdate - CIC Client SU6 Languagepack NL cannot be succesfully installed - " $process.ExitCode | out-file $logfile -Append exit } # Opschonen Desktop en Start menu Remove-Item -Path "$env:PUBLIC\Desktop\Interaction Fax.lnk" Remove-Item -Path "$env:PUBLIC\Desktop\Interaction Voicemail Player.lnk" Move-Item -Path "$env:SYSTEMDRIVE\ProgramData\Microsoft\Windows\Start Menu\Programs\Interactive Intelligence" "$env:SYSTEMDRIVE\ProgramData\Microsoft\Windows\Start Menu\Programs\Abvakabo FNV" -force
The uninstall part works fine, but the installation (2 parts) do not. As I mentioned before... when I run the script manually it all works fine.
The application is installed using a script. The commandline is
powershell.exe -excecutionpolicy bypass -file Install_UserApps_SU6_Kantoor.ps1
The application runs hidden in the context of the system wether or not the user is logged on. The maximum allowed run time is sufficient (30 minutes).
There is no installation log from the msiexec command so the line were the application should be installed is not executed at all. There is also no mention in my own little log ($logfile = "$env:TEMP\cic_su6-install.txt") mentioning the result of the installation.
The appenforce.log says...
+++ Starting Install enforcement for App DT "Interaction Client - Standaard SU6" ApplicationDeliveryType - ScopeId_2EC1E80A-D73E-4152-A94F-546E7827CCB6/DeploymentType_720b132a-5626-4055-9555-18b4775724c4, Revision - 7, ContentPath - C:\WINDOWS\ccmcache\13, Execution Context - System AppEnforce 17-4-2015 16:31:05 640 (0x0280) A user is logged on to the system. AppEnforce 17-4-2015 16:31:05 640 (0x0280) Performing detection of app deployment type Interaction Client - Standaard SU6(ScopeId_2EC1E80A-D73E-4152-A94F-546E7827CCB6/DeploymentType_720b132a-5626-4055-9555-18b4775724c4, revision 7) for system. AppEnforce 17-4-2015 16:31:05 640 (0x0280)+++ Application not discovered. [AppDT Id: ScopeId_2EC1E80A-D73E-4152-A94F-546E7827CCB6/DeploymentType_720b132a-5626-4055-9555-18b4775724c4, Revision: 7] AppEnforce 17-4-2015 16:31:05 640 (0x0280) App enforcement environment: Context: Machine Command line: Powershell.exe -executionpolicy bypass -file Install_UserApps_SU6_Kantoor.ps1 Allow user interaction: No UI mode: 0 User token: null Session Id: 1 Content path: C:\WINDOWS\ccmcache\13 Working directory: AppEnforce 17-4-2015 16:31:05 640 (0x0280) Prepared working directory: C:\WINDOWS\ccmcache\13 AppEnforce 17-4-2015 16:31:05 640 (0x0280) Found executable file Powershell.exe with complete path C:\WINDOWS\System32\WindowsPowerShell\v1.0\Powershell.exe AppEnforce 17-4-2015 16:31:05 640 (0x0280) Prepared command line: "C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe" -executionpolicy bypass -file Install_UserApps_SU6_Kantoor.ps1 AppEnforce 17-4-2015 16:31:05 640 (0x0280) Executing Command line: "C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe" -executionpolicy bypass -file Install_UserApps_SU6_Kantoor.ps1 with user context AppEnforce 17-4-2015 16:31:05 640 (0x0280) Working directory C:\WINDOWS\ccmcache\13 AppEnforce 17-4-2015 16:31:05 640 (0x0280) Post install behavior is BasedOnExitCode AppEnforce 17-4-2015 16:31:05 640 (0x0280) Waiting for process 2916 to finish. Timeout = 30 minutes. AppEnforce 17-4-2015 16:31:05 640 (0x0280) Process 2916 terminated with exitcode: 0 AppEnforce 17-4-2015 16:31:08 640 (0x0280) Looking for exit code 0 in exit codes table... AppEnforce 17-4-2015 16:31:08 640 (0x0280) Matched exit code 0 to a Success entry in exit codes table. AppEnforce 17-4-2015 16:31:08 640 (0x0280) Performing detection of app deployment type Interaction Client - Standaard SU6(ScopeId_2EC1E80A-D73E-4152-A94F-546E7827CCB6/DeploymentType_720b132a-5626-4055-9555-18b4775724c4, revision 7) for system. AppEnforce 17-4-2015 16:31:08 640 (0x0280)+++ Application not discovered. [AppDT Id: ScopeId_2EC1E80A-D73E-4152-A94F-546E7827CCB6/DeploymentType_720b132a-5626-4055-9555-18b4775724c4, Revision: 7] AppEnforce 17-4-2015 16:31:08 640 (0x0280)++++++ App enforcement completed (3 seconds) for App DT "Interaction Client - Standaard SU6" [ScopeId_2EC1E80A-D73E-4152-A94F-546E7827CCB6/DeploymentType_720b132a-5626-4055-9555-18b4775724c4], Revision: 7, User SID: ] ++++++ AppEnforce 17-4-2015 16:31:08 640 (0x0280)
I'm thinking of going back to a batchfile because that seems to do the job, but Powershell is much more powerfull.
Anybody got any answers on what is going wrong are some suggestions for a better script?