cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
ferdydek
Engaged Sweeper
How to run PowerShell script via Deployment Packages?
1 ACCEPTED SOLUTION
keys_it
Engaged Sweeper III
We have issues with just running this way due to the execution policy (for security reasons we do not change the default).

A better way to avoid having this issue is to run PowerShell commands and scripts this way in a command step:

PowerShell Commands
powershell.exe -executionpolicy bypass -command {"commands go here"}


PowerShell Scripts
powershell.exe -executionpolicy bypass -file "{PackageShare}\Scripts\script.ps1"


This will guarantee that PowerShell commands and scripts run as intended.

View solution in original post

2 REPLIES 2
keys_it
Engaged Sweeper III
We have issues with just running this way due to the execution policy (for security reasons we do not change the default).

A better way to avoid having this issue is to run PowerShell commands and scripts this way in a command step:

PowerShell Commands
powershell.exe -executionpolicy bypass -command {"commands go here"}


PowerShell Scripts
powershell.exe -executionpolicy bypass -file "{PackageShare}\Scripts\script.ps1"


This will guarantee that PowerShell commands and scripts run as intended.
Daniel_B
Lansweeper Alumni
In a command step you can use the command

powershell "[powershell command]"


Open a cmd on your computer and type

powershell -help

in order to see details about which parameters are available.