So, I’ve been deep in PowerShell recently and realised it has been way too long since I dropped a useful post.
Many people have blogged about this, stating that it is required to create a CMD or Batch file inside the Intune-Win32-App-Packaging-Tool to launch the script from and then run that.
Well, you don’t… 😉
Follow the usual packaging procedure using the Intune-Win32-App-Packaging-Tool but adjust your install and uninstall command lines to run the script as follows:
Install Command:
|
1 |
"%windir%\sysnative\WindowsPowerShell\v1.0\powershell.exe" -ExecutionPolicy Bypass -WindowStyle Hidden -File .\YourScriptName.ps1 |
Uninstall Command:
|
1 |
"%windir%\sysnative\WindowsPowerShell\v1.0\powershell.exe" -ExecutionPolicy Bypass -WindowStyle Hidden -File .\YourScriptName.ps1 |
If your script is built with parameters this also works as well For example:
Install Command with Parameters: Uninstall Command with Parameters: Cheers, SCCMOG