Deploy SCCM Application using powershell script

How to deploy a application or a PowerShell Script as a SCCM Application


In this article I will cover how to deploy a application using a Powershell script or how to depploy a powershell script as a application.
In many cases I deliver apps plus a few other changes and a PowerShell script become very handy.
I will not cover how to do an app from scratch ūüėä , I have another more complex article who covver how to creat an application: Install Adobe Reader DC with SCCM ¬†
What is different from a normal application is the installation program command: Powershell.exe -ExecutionPolicy ByPass -File "app.ps1"

install-app-powershell-script

AppEnforce.log

    Prepared working directory: C:\WINDOWS\ccmcache\e AppEnforce 06/09/2019 14:52:57 112 (0x0070)
    Found executable file Powershell.exe with complete path C:\WINDOWS\System32\WindowsPowerShell\v1.0\Powershell.exe AppEnforce 06/09/2019 14:52:57 112 (0x0070)
    Prepared command line: "C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe" -ExecutionPolicy ByPass -File "App.ps1" AppEnforce 06/09/2019 14:52:57 112 (0x0070)
    Executing Command line: "C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe" -ExecutionPolicy ByPass -File "App.ps1" with system context AppEnforce 06/09/2019 14:52:57 112 (0x0070)
    Working directory C:\WINDOWS\ccmcache\e AppEnforce 06/09/2019 14:52:57 112 (0x0070)
    Post install behavior is BasedOnExitCode AppEnforce 06/09/2019 14:52:57 112 (0x0070)
    Waiting for process 512 to finish.  Timeout = 15 minutes. AppEnforce 06/09/2019 14:52:57 112 (0x0070)
    Process 512 terminated with exitcode: 0 AppEnforce 06/09/2019 14:53:55 112 (0x0070)
    Looking for exit code 0 in exit codes table... AppEnforce 06/09/2019 14:53:55 112 (0x0070)
    Matched exit code 0 to a Success entry in exit codes table. AppEnforce 06/09/2019 14:53:55 112 (0x0070)

Very easy, no, hppy SCCM-ing ūüėä?