通常是`Get-ExecutionPolicy`-未捕获的ReferenceError:未定义Get

问题描述 投票:0回答:1

我正在按照Chocolately Install步骤(Windows 7),但是遇到了两个问题。

首先,我已经打开了[[命令提示符(用以管理员身份运行将其打开),但是当尝试执行Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))时,出现此错误:

未捕获的语法错误:意外的标识符

..突出显示我命令的https:部分。

此外,当我尝试执行Get-ExecutionPolicy时,结果为:

未捕获的ReferenceError:未定义Get

任何想法有什么问题吗?

*更新*

当我在

PowerShell

中尝试相同的命令时,出现此错误:
PS C:\ Users \ mylogin> Set-ExecutionPolicy绕过-Scope Process -Force;[System.Net.ServicePointManager] :: SecurityProtoc ol =[System.Net.ServicePointManager] :: SecurityProtocol -bor 3072;进出口(((新对象System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))例外设置“ SecurityProtocol”:“无法将值” 3312“转换为类型由于无效的枚举值,导致出现“ System.Net.SecurityProtocolType”。指定以下枚举值之一,然后重试。的可能的枚举值为“ Ssl3,Tls”。“在第1行char:85+ Set-ExecutionPolicy绕过-作用域处理-强制; [System.Net.ServicePointManager] :: <<<< SecurityProtocol = [系统。Net.ServicePointManager] :: SecurityProtocol -bor 3072; iex((新对象System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))+ CategoryInfo:InvalidOperation:(:) [],RuntimeException+ FullyQualifiedErrorId:PropertyAssignmentException

使用“ 1”作为参数调用“ DownloadString”的异常:“基础连接已关闭:发生意外错误发送。”在线:1字符:219+ Set-ExecutionPolicy绕过-作用域处理-强制; [System.Net.ServicePointManager] :: SecurityProtocol = [System.Net.ServicePointManager] :: SecurityProtocol -bor 3072; iex((新对象System.Net.WebClient).DownloadString <<<https://chocolatey.org/install.ps1'))+ CategoryInfo:未指定:(:) [],MethodInvocationException+ FullyQualifiedErrorId:DotNetMethodException

shell command-line chocolatey
1个回答
1
投票
Chocolatey.org requires TLS 1.2才能连接。此错误表明您不支持该安装:

System.Net.WebClient).DownloadString ('https://chocolatey.org/install.ps1')) Exception setting "SecurityProtocol": "Cannot convert value "3312" to type "System.Net.SecurityProtocolType" due to inv alid enumeration values. Specify one of the following enumeration values and try again. The possible enumeration values are "Ssl3, Tls"

我之前链接到的博客文章中的部分应该有所帮助:

如果您发现自己置备计算机,例如Windows 7,Windows Server 2008或更早版本,则在实施此更改后,您将发现这些计算机将无法与Chocolatey Community Repository通信。在这些情况下,您需要将alternative installation methods用于Chocolatey。我们强烈建议使用offline Chocolatey installation,因为它具有最大的灵活性和可靠性。

Chocolatey install page上列出了要求:

    Windows 7+ / Windows Server 2003 +
  • PowerShell v2 +(由于[C​​0],从此网站安装的最低版本是v3)
  • 。NET Framework 4+(如果没有安装,安装程序将尝试安装.NET 4.0)(由于[C​​0],从此网站安装的最低版本为4.5)
  • 我的建议是完全修补Windows 7系统,安装.NET 4.5,然后尝试。请记住,Windows 7自今年1月以来就不再受支持。
  • © www.soinside.com 2019 - 2024. All rights reserved.