Issue
When monitoring the application deployment through SCCM report, the following deployment error was logged for multiple devices.
Error description: Failed to verify the executable file is valid or to construct the associated command line
Further investigation on client machine shows below error in AppEnforce.log file.
Error in C:\Windows\ccm\logs\AppEnforce.log File :
App enforcement environment:
Context: Machine
Command line: Powershell.exe -ExecutionPolicy ByPass -File MyScript.ps1
Allow user interaction: No
UI mode: 0
User token: null
Session Id: 4294967295
Content path: C:\WINDOWS\ccmcache\3
Working directory:
Invalid executable file Powershell.exe
AppProvider::EnforceApp – Failed to invoke EnforceApp on Application handler ( 0x87d01106 ).
Cause for Error 0x87d01106
The application was trying to execute a PowerShell script. However, PowerShell.exe could not be located on client computers. The full path for Powershell.exe file was not provided in command line.
powershell.exe -ExecutionPolicy ByPass -File MyScript.ps1
PowerShell.exe path must be defined in PATH environment variable. By default, Powershell.exe path is defined in PATH environment variable however it may overwritten by other applications due to misconfiguration. Hence, the deployment will fail on the computers where Powershell.exe path does not exists in PATH environment variable.
Solution for Error 0x87d01106
It’s better to provide the complete path for PowerShell executable in program command line. This will eliminate the dependency over PATH environment variable as PowerShell.exe can be located by the path provided with command line.
The complete path to execute PowerShell script should be like this:
%SystemRoot%\system32\WindowsPowerShell\v1.0\powershell.exe -ExecutionPolicy ByPass -File MyScript.ps1
Related Posts:
- SCCM Application Deployment Failed with Error 0x87d01106 | ConfigMgr
- SCCM Client Installation Failed With Error Code 0x87d00215
- PXE-E99: Unexpected network error – SCCM OSD
- Configuration Manager OSD task sequence fails with error code 0x80004005
- MECM OSD Task Sequence Failed with Error 0x80072EE7
- SCCM Client Push Installation Failed with Error 0x800706ba
- Failed to Add Update Source for WUAgent of type (2) and id ({ID). Error = 0x80004005
- SCCM OSD – Domain Join Failed with Error code 0x54b on HP Elitebook 840 G8
- ccmsetup failed with error code 0x87d00227
- Fix Application Deployment error 0x87d00213 in ConfigMgr
- CMG Connection Point Status Disconnected | SCCM | ConfigMgr
- CMG Setup – Subscription ID drop down not populating
- CMG Setup – Error when granting Contributor permission to the Azure AD app
- Failed to connect with DP – Error Code 0x8004100e | ConfigMgr | SCCM
- SCCM Client Installation Failed with error 0x87d0027e
- ConfigMgr OSD – PXE Troubleshooting
- SCCM WSUS sync error – Sync Failed – WSUS server not configured
- SCCM Software Distribution Troubleshooting
Subscribe to Techuisitive Newsletter
Be the first to know about our new blog posts. Get our newsletters directly in your inbox and stay up to date about Modern Desktop Management technologies & news.