This is just a quick post to help those who are struggling to find the correct syntax to place into the program (CMD line) field when deploying a PowerShell Script as an application or program for that matter using SCCM.
For an “Application” “Deployment type” just place this into the Program line.
1 |
Powershell.exe -ExecutionPolicy ByPass -File Your-Scriptfilename.PS1 |
For a “Package” “Program ” just place this into the CMD line.
1 |
"%Windir%\sysnative\WindowsPowerShell\v1.0\powershell.exe" -ExecutionPolicy Bypass -Command .\Your-Scriptfilename.ps1 |
Note: When using MDT install applications step in you task sequence (Customsettings or MDT DB driven) to install programs this also works a treat!
You can add other properties also like -NoProfile but to be honest I have found this to work 100% of the time without the need for those extras. Just make sure you detection method is solid!