powershell - 无法在 Windows 2012 R2 机器上运行 Get-WindowsOptionalFeature 命令
问题描述
运行 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
推荐阅读
- c# - 使用 dotnetzip 库附加到电子邮件后无法打开 Zip 文件
- angular - 无法在 eslint 中为 typescript linting 关闭规则显式函数返回类型
- python - 如何将GDAL降级到2.4版?
- css - 让独立的孩子在没有明确身高的情况下拥有父母的 100% 身高
- jenkins - 如何在测试工具中模拟 Jenkins 作业参数?
- c# - 索引超出 C# 控制台应用程序中数组错误的范围
- c# - 存储过程返回可为空的 DateTime 而不是 varchar
- python-3.x - python中的doopl参数设置
- sql - 在 SQL 中,有没有办法拆分 SQL 中存储为列表的列?
- ruby-on-rails - 在 ruby on rails 中自定义 JSON 响应