ms-iot/iot-adk-addonkit

IoTCorePShell.cmd does not properly set execution policy.

Closed this issue · 2 comments

When attempting to start the IoTCore Power Shell I was confronted with a never ending list of security warnings.

Security warning Run only scripts that you trust. While scripts from the internet can be useful, this script can potentially harm your computer. If you trust this script, use the Unblock-File cmdlet to allow the script to run without this warning message. Do you want to run C:\IoTCoreBSP\iot-adk-addonkit\Tools\IoTCoreImaging\Classes\IoTProvisioningXML.ps1? [D] Do not run [R] Run once [S] Suspend [?] Help (default is "D"): R

Changing the launch options in the IoTCorePshell.cmd was able to end this issue by changing the ExecutionPolicy from Unrestricted to Bypass.

powershell -Command "Start-Process 'powershell.exe' -ArgumentList '-noexit -ExecutionPolicy Bypass -Command \". %~dp0Tools\Launchshell.ps1\"' -Verb runAs"

If desired I can create a branch and submit a PR.

An additional note, it appears that when creating a workspace the .cmd created also attempts to use -ExecutionPolicy Unrestricted, which results in the same error.

thanks for the suggestion. Will make the change in the next update shortly