From 73a2fcae35bdbb1fe647a42ef049ef581c9fcc4f Mon Sep 17 00:00:00 2001 From: Mikhail-T Date: Sat, 24 Dec 2016 21:03:53 -0600 Subject: [PATCH] set execution policy on scoop install I've tested this by running updated script as below: ```iex (new-object net.webclient).downloadstring('https://gist.githubusercontent.com/mikhail-tsennykh/f65a3addf22b36681b1eb7c6d708bed2/raw/4040fe0c156512a63b1dcfea2fd5595b26e1a1f1/scoop%2520auto%2520set%2520execution%2520policy%2520test')``` nice to skip extra step (unless there is some good reason not to do it on scoop install). --- bin/install.ps1 | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/bin/install.ps1 b/bin/install.ps1 index 35193aa92..692d17059 100644 --- a/bin/install.ps1 +++ b/bin/install.ps1 @@ -4,6 +4,15 @@ # iex (new-object net.webclient).downloadstring('https://get.scoop.sh') $erroractionpreference='stop' # quit if anything goes wrong +# set correct execution policy automatically if not set already: +$ep = get-executionpolicy cu; +if ($ep -ne "unrestricted") { + # Set execution policy on the process to hide error message + # that will otherwise show first time this script is run + set-executionpolicy unrestricted p + set-executionPolicy unrestricted cu +} + # get core functions $core_url = 'https://raw.github.com/lukesampson/scoop/master/lib/core.ps1' echo 'initializing...'