I have a situation where it’s possible this package may run multiple times and I would like PSADT to ignore any errors, including if the path doesn’t exist. With the command below, the script is existing with code 60002 or 60001.
Questions
- The log state the path is valid, which it is not.
- I’m OK with using Test-Path before the command, but just wondering is I’m missing something.
Execute-Process -Path "$envWINDIR\CCMSetup\CCMSetup.exe" -Parameters "/Uninstall" -ContinueOnError $true
Log
[Pre-Installation] :: [C:\WINDOWS\CCMSetup\CCMSetup.exe] is a valid fully qualified path, continue.
[Pre-Installation] :: Function failed, setting exit code to [60002].
Error Record:
Message : File [C:\WINDOWS\CCMSetup\CCMSetup.exe] not found.
InnerException :
FullyQualifiedErrorId : File [C:\WINDOWS\CCMSetup\CCMSetup.exe] not found.
PositionMessage :
At C:\CCMClient\AppDeployToolkit\AppDeployToolkitMain.ps1:262
4 char:11
+ Throw <<<< “File [$Path] not found.”
[Pre-Installation] :: Close the installation progress dialog.