Delivering a package to run a Powershell script. The delivery stops asking for permission to run the script showing a Security Warning

Document ID : KB000018465
Last Modified Date : 14/02/2018
Show Technical Document Details

Description:

Delivering a package to run a Powershell script. The delivery stops asking for permission to run the script showing a Security Warning:

Security Warning
Run only scripts that you trust. While scripts from the Internet can be useful, this script can potentially harm your computer.
Do you want to run Z:\activate\B0E40622-CA09-444C-A51D-2C148E0F2214.itm\1.vol\myscript.ps1?
[D] Do not run [R] Run once [S] Suspend [?] Help (default is "D"):

Solution:

When the Software Delivery agent is configured to run procedures from the Software Library share (Internal NOS download method), the script is stored on the mapped drive (in this example Z:). Powershell does not allow the execution of the script from the mapped drive and the security warning is displayed.

Modify the procedure script to copy the powershell script from the package to a local directory like %Temp% and execute it. Example:

copy .\myscript.ps1 %Temp%
powershell %Temp%\myscript.ps1