PowerShell OpenSSHUtils
PowerShell OpenSSHUtils
我正在尝试在 Win 10 PS 5.1.
下导入模块 OpenSSHUtils
最新版本(无论版本号是多少)显然不可用。
> Install-Module -Force OpenSSHUtils -Scope CurrentUser
PackageManagement\Install-Package : No se encontró ninguna coincidencia para el criterio de búsqueda especificado y el nombre de paquete 'OpenSSHUtils'
...
> Find-Module -Name 'OpenSSHUtils' -Verbose
VERBOSE: Detalles del repositorio: Nombre = 'PSGallery', Ubicación = 'https://www.powershellgallery.com/api/v2'; IsTrusted = 'False'; IsRegistered = 'True'.
VERBOSE: Detalles del repositorio: Nombre = 'PSGallery', Ubicación = 'https://www.powershellgallery.com/api/v2'; IsTrusted = 'False'; IsRegistered = 'True'.
VERBOSE: Uso del proveedor 'PowerShellGet' para buscar paquetes.
VERBOSE: No se especificó el parámetro -Repository. PowerShellGet usará todos los repositorios registrados.
VERBOSE: Obteniendo el objeto de proveedor para el proveedor de PackageManagement 'NuGet'.
VERBOSE: La ubicación especificada es 'https://www.powershellgallery.com/api/v2' y el proveedor de PackageManagement es 'NuGet'.
VERBOSE: Searching repository 'https://www.powershellgallery.com/api/v2/FindPackagesById()?id='OpenSSHUtils'' for ''.
VERBOSE: Total package yield:'0' for the specified package 'OpenSSHUtils'.
PackageManagement\Find-Package : No se encontró ninguna coincidencia para el criterio de búsqueda especificado y el nombre de paquete 'OpenSSHUtils'. Prueba
Get-PSRepository para ver todos los orígenes de paquete registrados disponibles.
...
所以我尝试使用版本 1.0.0.1
> Install-Module -Name OpenSSHUtils -RequiredVersion 1.0.0.1 -Scope CurrentUser
Untrusted repository
You are installing the modules from an untrusted repository. If you trust this repository, change its InstallationPolicy value by running the Set-PSRepository cmdlet.
Are you sure you want to install the modules from 'PSGallery'?
[Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "N"): y
PackageManagement\Install-Package : El módulo "OpenSSHUtils" no se puede instalar ni actualizar porque la firma Authenticode del archivo "OpenSSHUtils.psd1" no es
válida.
...
当遇到签名问题时,我尝试下载 nuget 并按照 here, at https://www.powershellgallery.com/packages/OpenSSHUtils/1.0.0.1 所述在本地安装。
但它显然不再可用(“所有者已取消列出此软件包。这可能意味着该模块已被弃用或不应再使用。”)
请注意,我可以访问单个文件
https://www.powershellgallery.com/packages/OpenSSHUtils/1.0.0.1/Content/OpenSSHUtils.psd1
和
https://www.powershellgallery.com/packages/OpenSSHUtils/1.0.0.1/Content/OpenSSHUtils.psm1
.
所以我对一些问题很感兴趣。
主要是:
- 如何安装 OpenSSHUtils?
其他更细化的问题:
- 当我尝试从库中安装包时,问题出在签名上。
这是否意味着包实际上是可用的,我应该想办法解决签名问题?
也可能是包裹根本就没有?
- 如何解决签名问题?
- 在哪里可以找到 nuget 包?
- 拥有
psd1
和psm1
是否等同于拥有nuget?
相关:
快速回答
简而言之,OpenSSHUtils 已被 Microsoft 弃用(正如您所指出的)并且不再需要。不建议您尝试安装它。
如果您向我们说明您需要 OpenSSHUtils 的哪些功能,我们可以帮助您解决问题。
- 很可能您可以在 Windows OpenSSH Github Repo
上找到您要找的东西
此外,此 GitHub 评论引用了大多数关于弃用的未决问题。 https://github.com/MicrosoftDocs/windowsserverdocs/issues/3400#issuecomment-658249949
手动安装
不推荐这样做,但我解释它是为了让您更好地理解自定义模块。如果 Install-Module
在您的 PowerShell 版本上不可用,也可以使用它。
Where can I find the nuget package?
您实际上已经链接了它 (https://www.powershellgallery.com/packages/OpenSSHUtils/1.0.0.1)。如果您点击“手动下载”,您将能够手动下载它。
Is having the psd1 and psm1 equivalent to having the nuget?
psd1 是您使用该模块所需的全部。您需要手动安装它。
- 键入
$env:PSModulePath
以确定 PowerShell 在系统中查找模块的位置。推荐的位置是 C:\Windows\system32\WindowsPowerShell\v1.0\Modules\ 供系统范围使用。
C:\Users\user\Documents\WindowsPowerShell\Modules;C:\Program Files\WindowsPowerShell\Modules;C:\Windows\system32\WindowsPowerShell\v1.0\Modules\;c:\Program Files (x
86)\Microsoft SQL Server0\Tools\PowerShell\Modules\;C:\Program Files (x86)\VMware\Infrastructure\vSphere PowerCLI\Modules;C:\Program Files\Microsoft Monitoring Agent\
Agent\PowerShell\
在 C:\Windows\system32\WindowsPowerShell\v1.0\Modules\
中创建 OpenSSHUtils 目录
将目录和文件夹从 opensshutils.1.0.0.1.nupkg
复制到此位置。您可以丢弃 NuGet 特定项目 (package, OpenSSHUtils.nuspec, _rels, package, [Content_Types].xml)
使用 Get-Module -ListAvailable 验证 OpenSSHUtils 模块是否已列出
快速而简单的答案:
这是安装它所需的命令,以通过签名检查。 Install-Module -Name OpenSSHUtils -RequiredVersion 1.0.0.1 -SkipPublisherCheck -Scope CurrentUser
注意:(-Scope CurrentUser
是可选的,它在问题中,所以它在答案中。)
带解释的简短回答:
klabarge 关于 OpenSSHUtils 贬值 并且可能不再需要的说法是正确的,但是,如果您需要或想要安装它,它仍然是可能的,并且很简单。
PowerShell 命令很简单:Install-Module -Name OpenSSHUtils -RequiredVersion 1.0.0.1 -SkipPublisherCheck
如有必要,您可以使用 CurrentUser
或 AllUsers
添加其他参数,例如 -Scope
,但如果 Admin PowerShell 提示符中的 运行,则默认范围是 AllUsers
.
您将看到以下内容:Are you sure you want to install the modules from 'PSGallery'? [Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "N")
所以你必须按 Y
(或 A
)才能继续,允许它从 PSGallery 安装模块。
正如您在问题中所说:
So I tried with ver 1.0.0.1
Install-Module -Name OpenSSHUtils -RequiredVersion 1.0.0.1 -Scope CurrentUser
不受信任的存储库您正在从不受信任的位置安装模块
存储库。如果您信任此存储库,请更改其
通过 运行 设置 Set-PSRepository cmdlet 的 InstallationPolicy 值。是
您确定要从 'PSGallery' 安装模块吗? [Y] 是的
[A] 全部同意 [N] 否 [L] 全部否 [S] 暂停 [?] 帮助(默认
是 "N"): y PackageManagement\Install-Package : El módulo
"OpenSSHUtils" 没有安装它的实际应用程序 porque la firma
存档验证码“OpenSSHUtils.psd1”没有有效。 ... 什么时候
面对签名问题,我尝试下载 nuget 和
如此处所述在本地安装
https://www.powershellgallery.com/packages/OpenSSHUtils/1.0.0.1.
错误的相关部分,英文:
Install-Package : The module 'OpenSSHUtils' cannot be installed or updated because the authenticode
signature of the file 'OpenSSHUtils.psd1' is not valid.
所以,从本质上讲,它是用 Windows 10 不再认为有效的密钥签名的,因此,要绕过它,需要 -SkipPublisherCheck
。
然后,您可以在管理 Powershell 提示中,运行 Get-Module -ListAvailable | ? Name -like '*OpenSSHUtils*'
验证它是否已安装。
如果有效,您会看到类似这样的内容:
ModuleType Version Name ExportedCommands
---------- ------- ---- ----------------
Script 1.0.0.1 OpenSSHUtils {Repair-SshdHostKeyPermission, Repair-FilePermission, Repair-AuthorizedKeyPermissio...
我正在尝试在 Win 10 PS 5.1.
下导入模块 OpenSSHUtils最新版本(无论版本号是多少)显然不可用。
> Install-Module -Force OpenSSHUtils -Scope CurrentUser
PackageManagement\Install-Package : No se encontró ninguna coincidencia para el criterio de búsqueda especificado y el nombre de paquete 'OpenSSHUtils'
...
> Find-Module -Name 'OpenSSHUtils' -Verbose
VERBOSE: Detalles del repositorio: Nombre = 'PSGallery', Ubicación = 'https://www.powershellgallery.com/api/v2'; IsTrusted = 'False'; IsRegistered = 'True'.
VERBOSE: Detalles del repositorio: Nombre = 'PSGallery', Ubicación = 'https://www.powershellgallery.com/api/v2'; IsTrusted = 'False'; IsRegistered = 'True'.
VERBOSE: Uso del proveedor 'PowerShellGet' para buscar paquetes.
VERBOSE: No se especificó el parámetro -Repository. PowerShellGet usará todos los repositorios registrados.
VERBOSE: Obteniendo el objeto de proveedor para el proveedor de PackageManagement 'NuGet'.
VERBOSE: La ubicación especificada es 'https://www.powershellgallery.com/api/v2' y el proveedor de PackageManagement es 'NuGet'.
VERBOSE: Searching repository 'https://www.powershellgallery.com/api/v2/FindPackagesById()?id='OpenSSHUtils'' for ''.
VERBOSE: Total package yield:'0' for the specified package 'OpenSSHUtils'.
PackageManagement\Find-Package : No se encontró ninguna coincidencia para el criterio de búsqueda especificado y el nombre de paquete 'OpenSSHUtils'. Prueba
Get-PSRepository para ver todos los orígenes de paquete registrados disponibles.
...
所以我尝试使用版本 1.0.0.1
> Install-Module -Name OpenSSHUtils -RequiredVersion 1.0.0.1 -Scope CurrentUser
Untrusted repository
You are installing the modules from an untrusted repository. If you trust this repository, change its InstallationPolicy value by running the Set-PSRepository cmdlet.
Are you sure you want to install the modules from 'PSGallery'?
[Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "N"): y
PackageManagement\Install-Package : El módulo "OpenSSHUtils" no se puede instalar ni actualizar porque la firma Authenticode del archivo "OpenSSHUtils.psd1" no es
válida.
...
当遇到签名问题时,我尝试下载 nuget 并按照 here, at https://www.powershellgallery.com/packages/OpenSSHUtils/1.0.0.1 所述在本地安装。 但它显然不再可用(“所有者已取消列出此软件包。这可能意味着该模块已被弃用或不应再使用。”) 请注意,我可以访问单个文件 https://www.powershellgallery.com/packages/OpenSSHUtils/1.0.0.1/Content/OpenSSHUtils.psd1 和 https://www.powershellgallery.com/packages/OpenSSHUtils/1.0.0.1/Content/OpenSSHUtils.psm1 .
所以我对一些问题很感兴趣。 主要是:
- 如何安装 OpenSSHUtils?
其他更细化的问题:
- 当我尝试从库中安装包时,问题出在签名上。 这是否意味着包实际上是可用的,我应该想办法解决签名问题? 也可能是包裹根本就没有?
- 如何解决签名问题?
- 在哪里可以找到 nuget 包?
- 拥有
psd1
和psm1
是否等同于拥有nuget?
相关:
快速回答
简而言之,OpenSSHUtils 已被 Microsoft 弃用(正如您所指出的)并且不再需要。不建议您尝试安装它。
如果您向我们说明您需要 OpenSSHUtils 的哪些功能,我们可以帮助您解决问题。
- 很可能您可以在 Windows OpenSSH Github Repo 上找到您要找的东西
此外,此 GitHub 评论引用了大多数关于弃用的未决问题。 https://github.com/MicrosoftDocs/windowsserverdocs/issues/3400#issuecomment-658249949
手动安装
不推荐这样做,但我解释它是为了让您更好地理解自定义模块。如果 Install-Module
在您的 PowerShell 版本上不可用,也可以使用它。
Where can I find the nuget package?
您实际上已经链接了它 (https://www.powershellgallery.com/packages/OpenSSHUtils/1.0.0.1)。如果您点击“手动下载”,您将能够手动下载它。
Is having the psd1 and psm1 equivalent to having the nuget?
psd1 是您使用该模块所需的全部。您需要手动安装它。
- 键入
$env:PSModulePath
以确定 PowerShell 在系统中查找模块的位置。推荐的位置是 C:\Windows\system32\WindowsPowerShell\v1.0\Modules\ 供系统范围使用。
C:\Users\user\Documents\WindowsPowerShell\Modules;C:\Program Files\WindowsPowerShell\Modules;C:\Windows\system32\WindowsPowerShell\v1.0\Modules\;c:\Program Files (x
86)\Microsoft SQL Server0\Tools\PowerShell\Modules\;C:\Program Files (x86)\VMware\Infrastructure\vSphere PowerCLI\Modules;C:\Program Files\Microsoft Monitoring Agent\
Agent\PowerShell\
在 C:\Windows\system32\WindowsPowerShell\v1.0\Modules\
中创建 OpenSSHUtils 目录将目录和文件夹从
opensshutils.1.0.0.1.nupkg
复制到此位置。您可以丢弃 NuGet 特定项目 (package, OpenSSHUtils.nuspec, _rels, package, [Content_Types].xml)使用 Get-Module -ListAvailable 验证 OpenSSHUtils 模块是否已列出
快速而简单的答案:
这是安装它所需的命令,以通过签名检查。 Install-Module -Name OpenSSHUtils -RequiredVersion 1.0.0.1 -SkipPublisherCheck -Scope CurrentUser
注意:(-Scope CurrentUser
是可选的,它在问题中,所以它在答案中。)
带解释的简短回答:
klabarge 关于 OpenSSHUtils 贬值 并且可能不再需要的说法是正确的,但是,如果您需要或想要安装它,它仍然是可能的,并且很简单。
PowerShell 命令很简单:Install-Module -Name OpenSSHUtils -RequiredVersion 1.0.0.1 -SkipPublisherCheck
如有必要,您可以使用 CurrentUser
或 AllUsers
添加其他参数,例如 -Scope
,但如果 Admin PowerShell 提示符中的 运行,则默认范围是 AllUsers
.
您将看到以下内容:Are you sure you want to install the modules from 'PSGallery'? [Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "N")
所以你必须按 Y
(或 A
)才能继续,允许它从 PSGallery 安装模块。
正如您在问题中所说:
So I tried with ver 1.0.0.1
Install-Module -Name OpenSSHUtils -RequiredVersion 1.0.0.1 -Scope CurrentUser
不受信任的存储库您正在从不受信任的位置安装模块 存储库。如果您信任此存储库,请更改其 通过 运行 设置 Set-PSRepository cmdlet 的 InstallationPolicy 值。是 您确定要从 'PSGallery' 安装模块吗? [Y] 是的 [A] 全部同意 [N] 否 [L] 全部否 [S] 暂停 [?] 帮助(默认 是 "N"): y PackageManagement\Install-Package : El módulo "OpenSSHUtils" 没有安装它的实际应用程序 porque la firma 存档验证码“OpenSSHUtils.psd1”没有有效。 ... 什么时候 面对签名问题,我尝试下载 nuget 和 如此处所述在本地安装 https://www.powershellgallery.com/packages/OpenSSHUtils/1.0.0.1.
错误的相关部分,英文:
Install-Package : The module 'OpenSSHUtils' cannot be installed or updated because the authenticode
signature of the file 'OpenSSHUtils.psd1' is not valid.
所以,从本质上讲,它是用 Windows 10 不再认为有效的密钥签名的,因此,要绕过它,需要 -SkipPublisherCheck
。
然后,您可以在管理 Powershell 提示中,运行 Get-Module -ListAvailable | ? Name -like '*OpenSSHUtils*'
验证它是否已安装。
如果有效,您会看到类似这样的内容:
ModuleType Version Name ExportedCommands
---------- ------- ---- ----------------
Script 1.0.0.1 OpenSSHUtils {Repair-SshdHostKeyPermission, Repair-FilePermission, Repair-AuthorizedKeyPermissio...