Today I did some testing with installing an application in SCCM using PowerShell. I found out a few interested things and I want to share it with you guys.
In order for an application to be successfully installed, there are few things that we have to setup.
1. Change the PowerShell execution policy
From Client Settings, change the PowerShell execution policy to Bypass in the Computer Agent category.
If we don’t do this, we’ll get an error message when trying to install the application from the application catalog.
The error is also captured in the AppDiscovery.log file on the client.
Note: You may not have to do step 1, if you don’t use PowerShell script for application detection.
2. Include the Bypass ExecutionPolicy in the install command
If you don’t set the PowerShell ExecutionPolicy to Bypass or Unrestricted on your machine, you have to include it in the install command similar as below.
powershell.exe -ExecutionPolicy Bypass -file “.\Install.ps1”
If not, you will get an unmatched return code 1 error, captured in the AppEnforce.log file.