Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bin/install.ps1 : very strange powershell execution policy check #3590

Closed
copdips opened this issue Aug 11, 2019 · 3 comments
Closed

bin/install.ps1 : very strange powershell execution policy check #3590

copdips opened this issue Aug 11, 2019 · 3 comments

Comments

@copdips
Copy link
Contributor

copdips commented Aug 11, 2019

Hello,

https://github.com/lukesampson/scoop/blob/master/bin/install.ps1#L15 says:

# show notification to change execution policy:
if((Get-ExecutionPolicy) -gt 'RemoteSigned' -or (Get-ExecutionPolicy) -eq 'ByPass') {
    Write-Output "PowerShell requires an execution policy of 'RemoteSigned' to run Scoop."
    Write-Output "To make this change please run:"
    Write-Output "'Set-ExecutionPolicy RemoteSigned -scope CurrentUser'"
    break
}

Which means that any executionpolicy greater than RemoteSigned cannot install scoop.
But Bypass is greater than RemoteSigned that cannot install scoop ?

> Get-ExecutionPolicy ; (Get-ExecutionPolicy) -gt 'RemoteSigned'
Bypass
True

I managed to install scoop by downloading the file install.ps1 locally and removing the if block.

Could you please check the if condition.

@r15ch13
Copy link
Member

r15ch13 commented Aug 13, 2019

Did the installation with Bypass work?
Maybe I made a mistake and it should have been -neq 'ByPass'.

Information for myself:

[System.Enum]::GetValues([Microsoft.PowerShell.ExecutionPolicy]) |
Sort-Object -Property @{Expression = {[int]$_}; Descending = $False} |
% { "$([int]$_) => $_" }
0 => Unrestricted
1 => RemoteSigned
2 => AllSigned
3 => Restricted
4 => Bypass
5 => Undefined

https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_execution_policies?view=powershell-6

@copdips
Copy link
Contributor Author

copdips commented Aug 23, 2019

Yes currently bypass cannot install scoop

@copdips
Copy link
Contributor Author

copdips commented Aug 24, 2019

@r15ch13

I think your suggestion on -neq 'ByPass' should fix the issue.
Or make an explict choose of the execution policy ( (Get-ExecutionPolicy).ToString()) instead of the int comparaison. Because it's a little bit strange to set the ByPass at 4, nobody outside of the powershell team can know why, this is too internals.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants