问题描述
运行 Get-WindowsOptionalFeature 命令时收到以下错误消息。
PS C:\Windows\system32> Get-WindowsOptionalFeature -Online -FeatureName SMB1Protocol
Get-WindowsOptionalFeature : An error occured. No operation was performed.
Verify that disM is installed properly in the image,and then try the operation again.
At line:1 char:1
+ Get-WindowsOptionalFeature -Online -FeatureName SMB1Protocol
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Get-WindowsOptionalFeature],COMException
+ FullyQualifiedErrorId : Microsoft.dism.Commands.GetwindowsOptionalFeatureCommand
解决方法
确保您的 DISM 确实在使用:
dism /online /Get-FeatureInfo /FeatureName:SMB1Protocol
仔细检查您的 Windows 版本是否也有正确的版本。有时,如果您安装了其他版本的 WAIK,则可能会导致这种情况,例如:
gwmi win32_operatingsystem | fl *
caption : Microsoft Windows Server 2012 R2 Standard
BuildNumber : 9600
Version : 6.3.9600
dism /online /get-feature
Deployment Image Servicing and Management tool
Version: 6.3.9600.19408 # Version of dism
Image Version: 6.3.9600.19397 # Version of windows