Install Application using PowerShell in SCCM

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.

clientsetting_powershell

If we don’t do this, we’ll get an error message when trying to install the application from the application catalog.

error1

The error is also captured in the AppDiscovery.log file on the client.

error2

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.

Have fun!

 

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s