尝试使用 Powershell 安装 Sysinternals 时的警告

Warnings When Attempting to Install Sysinternals With Powershell

我正在尝试使用 powershell 安装 sysinternals 软件包,但收到大量警告。应该注意的是,我正在遵循一组说明并且对这个主题还不太了解。以下是尝试 运行 install-package 命令时的警告:

Install-Package sysinternals
WARNING: NuGet: System.InvalidOperationException: Unable to find version '1.3.5.1' of package 'chocolatey-core.extension'.
WARNING: NuGet:    at NuGet.PackageRepositoryHelper.ResolvePackage(IPackageRepository sourceRepository, IPackageRepository
localRepository, IPackageConstraintProvider constraintProvider, String packageId, SemanticVersion version, Boolean
allowPrereleaseVersions)
WARNING: NuGet:    at NuGet.PackageManager.InstallPackage(String packageId, SemanticVersion version, Boolean ignoreDependencies,
Boolean allowPrereleaseVersions)
WARNING: NuGet:    at NuGet.Commands.InstallCommand.InstallPackage(IFileSystem fileSystem, String packageId, SemanticVersion version)
WARNING: NuGet:    at NuGet.Program.Main(String[] args)
WARNING: NuGet: System.InvalidOperationException: Unable to find version '2019.12.19' of package 'sysinternals'.

至于我之前所做的,我只安装了 Chocolatey 包提供程序并更新了 windows,但也许我做错了什么?以下是实现此目的的步骤:

Set-ExecutionPolicy RemoteSigned
Install-PackageProvider Chocolatey

Install-Module -Name PSWindowsUpdate
Get-WUInstall -Verbose
Get-WUInstall -Install

非常感谢任何帮助。

虽然您可以使用 Chocolatey 和 NuGet,但 PowerShell 的包管理器是 PowerShellGet(好吧,它在设计上使用了 NuGet)。所以,Choco 并不是真正需要的,但是,许多人仍然安装并使用它作为其他来源。

如果您直接使用 PowerShellGet,您会看到同样的错误。

Find-Module -Name 'SysInternals' -AllVersions | 
Format-Table -AutoSize
<#
# Results
PackageManagement\Find-Package : No match was found for the specified search criteria and module name 'SysInternals'. Try Get-PSRepository to see all available registered module 
repositories.
At C:\Users\Daniel\Documents\WindowsPowerShell\Modules\PowerShellGet.2.3\PSModule.psm1:8873 char:9
+         PackageManagement\Find-Package @PSBoundParameters | Microsoft ...
+         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (Microsoft.Power...ets.FindPackage:FindPackage) [Find-Package], Exception
    + FullyQualifiedErrorId : NoMatchFoundForCriteria,Microsoft.PowerShell.PackageManagement.Cmdlets.FindPackage

#>

Find-Package -Name 'SysInternals' -AllVersions | 
Format-Table -AutoSize
<#
# Results

Find-Package : No match was found for the specified search criteria and package name 'SysInternals'. Try Get-PackageSource to see all available registered package sources.
At line:1 char:1
+ Find-Package -Name 'SysInternals' -AllVersions |
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (Microsoft.Power...ets.FindPackage:FindPackage) [Find-Package], Exception
    + FullyQualifiedErrorId : NoMatchFoundForCriteria,Microsoft.PowerShell.PackageManagement.Cmdlets.FindPackage
#>

但是,如果您进行通配符搜索...

Find-Module -Name '*Internals*' |
Format-Table -AutoSize
<#
# Results

Version Name          Repository Description                                                                                                                                               
------- ----          ---------- -----------                                                                                                                                               
1.0.34  PoshInternals PSGallery  Collection of system internals tools for PowerShell.                                                                                                      
4.3     DSInternals   PSGallery  The DSInternals PowerShell Module exposes several internal features of Active Directory and Azure Active Directory. These include FIDO2 and NGC key aud...
0.2.8   AADInternals  PSGallery  The AADInternals PowerShell Module utilises several internal features of Azure Active Directory, Office 365, and related admin tools. DISCLAIMER: Funct...
0.1     LCMInternals  PSGallery  Demo scripts explaining the internals of LCM  
#>

Find-Package -Name '*Internals*' | 
Format-Table -AutoSize
<#
# Results

Name                                    Version Source    Summary                                                                                                                          
----                                    ------- ------    -------                                                                                                                          
PoshInternals                           1.0.34  PSGallery Collection of system internals tools for PowerShell.                                                                             
DSInternals                             4.3     PSGallery The DSInternals PowerShell Module exposes several internal features of Active Directory and Azure Active Directory. These incl...
AADInternals                            0.2.8   PSGallery The AADInternals PowerShell Module utilises several internal features of Azure Active Directory, Office 365, and related admin...
LCMInternals                            0.1     PSGallery Demo scripts explaining the internals of LCM                                                                                     
SilverlightToolkit-Internals-Unofficial 1.0.0   nuget.org The missing part of Microsoft Silverlight Toolkit. The internals DLL. 'System.Windows.Controls.Toolkit.Internals'                
AppInternals.Agent.Cloud.Support        10.10.0 nuget.org Configure an Azure Cloud Service solution for AppInternals application performance monitoring.                                   
InternalsVisibleTo.MSBuild              1.0.3   nuget.org Enables declaring 'InternalsVisibleTo' items in a .NET project file, rather than declaring them to an AssemblyInfo.cs file.      
Akrual.DDD.Utils.Internals              1.0.8   nuget.org Useful Classes yo use everywhere                                                                                                 
Meziantou.MSBuild.InternalsVisibleTo    1.0.1   nuget.org Allow to declare 'InternalsVisibleTo' in the csproj file, rather than declaring them to an AssemblyInfo.cs file.                 
microServiceBus.InternalService         1.0.0   nuget.org This package creates a stub from which you can create an Internal Service for microServiceBus.com   
#>

因此,如您所见,没有要安装的 module/package 称为 SysInternals 的东西。

您只需从此处下载 zip 文件并解压并正常使用它。

系统内部套件 https://docs.microsoft.com/en-us/sysinternals/downloads/sysinternals-suite

我遇到了同样的问题,发现 很有帮助。问题似乎与 TLS 1.3 有关,答案的第二部分——更改 .Net Framework 默认 TLS 版本——允许我通过 PowerShell 完成我的 sysinternals 安装。然后我就删除了我创建的新注册码。我想我只需要等待,随着我在 PS.

中继续学习更多并更多地使用包管理,看看这是否会再次出现