From dba024e903f1b12d42da3015cfbc1b5ba8edeb51 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B7=BA=E6=B7=85?= Date: Mon, 27 Apr 2020 04:05:49 +0800 Subject: [PATCH] Update sudo.ps1 make it to inherit the execution policy from parent shell --- sudo.ps1 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sudo.ps1 b/sudo.ps1 index 485e9c4..733a5b7 100644 --- a/sudo.ps1 +++ b/sudo.ps1 @@ -3,9 +3,9 @@ Set-StrictMode -Off; if(!$args) { "usage: sudo "; exit 1 } $powershellExe = Get-Process -Id $pid | Select-Object -ExpandProperty Path -$commandPrefix = '' +$commandPrefix = "-ExecutionPolicy $(Get-ExecutionPolicy) " if ($host.Version.Major -gt 5) { - $commandPrefix = '-Command' + $commandPrefix += '-Command' } function is_admin {