“Get-WindowsFeature -Name Hyper-V”停留在 20%

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

我已经执行了以下命令:

Get-WindowsFeature -Name Hyper-V | Select-Object InstallState 

卡在20%了

我等了30分钟还是没有反应。

有什么具体原因以及我应该如何摆脱这个吗?

操作系统:W2K12R2

Powershell 版本:

powershell
2个回答
0
投票

这很奇怪,我从未发生过这种情况,但可能表明您正在使用的计算机上有问题。您也没有说明您在哪个操作系统版本上看到此内容,即 WS2008 - 2019。

无论如何,尝试几种不同的方法看看结果如何。

Get-WindowsFeature -Name '*hyper-v' | Select-Object -Property *
Name                      : Hyper-V
DisplayName               : Hyper-V
Description               : Hyper-V provides ... 
                            virtualized ...
                            simultaneously.
Installed                 : False
InstallState              : Available
FeatureType               : Role
Path                      : Hyper-V
Depth                     : 1
DependsOn                 : {}
Parent                    : 
ServerComponentDescriptor : ServerComponent_HyperV
SubFeatures               : {}
SystemService             : {vmms}
Notification              : {}
BestPracticesModelId      : Microsoft/Windows/Hyper-V
EventQuery                : Virtualization.Events.xml
PostConfigurationNeeded   : False
AdditionalInfo            : {MajorVersion, Mino...


(Get-WindowsFeature -Name '*hyper-v').Installed
False

(Get-WindowsFeature -Name '*hyper-v').InstallState
Available

Get-WindowsFeature -Name Hyper-V | Select-Object InstallState
                                                              InstallState
                                                              ------------
                                                              Available

Get-WindowsFeature -Name Hyper-V | Select-Object InstallState | ft -HideTableHeaders
                                                              Available

Get-WindowsFeature -Name Hyper-V | Select-Object InstallState | ft -HideTableHeaders | Out-String
                                                              Available

另外,当默认值是字符串时,使用 Out-String 的原因是什么?


0
投票

重新启动计算机并再次运行命令为我解决了这个问题。

© www.soinside.com 2019 - 2024. All rights reserved.