New
#360
OK. In that case, you can leave execution policy always as restricted and in PowerShell run scripts with following command, always bypassing current policy:
powershell.exe -executionpolicy bypass [ScriptPath\ScriptName.ps1]
This runs script regardless of current policy. In my case, variable $Scripts points to my scripts folder, I could for instance run my CreateUSB.ps1 script (tutorial) to create W10 USB install media with following command, even if my execution policy would be set to Restricted:
To make it even easier, I could run following command:
& [ScriptPath\ScriptName.ps1] -ExecutionPolicy Bypass
The difference is, the first command can be run from both Command Prompt, PowerShell and RUN dialog, whereas the latter needs to be run from PowerShell.
Kari