在Power Shell 5中推荐Get-WindowsFeature?

时间:2018-02-13 14:26:39

标签: powershell

当我在PowerShell 5中输入命令Get-WindowsFeature时,它显示此错误,我不知道为什么!

Get-WindowsFeature: The term "Get-WindowsFeature" is not recognized as a cmdlet name,
function, script file or executable program. Check the spelling of the name, or if a path
access exists, verify that the path is correct and try again.
To the character Line: 1: 1
+ Get-WindowsFeature
+ ~~~~~~~~~~~~~~~~~~
     + CategoryInfo: ObjectNotFound: (Get-WindowsFeature: String) [], CommandNotFoundException
     + FullyQualifiedErrorId: CommandNotFoundException

enter image description here

2 个答案:

答案 0 :(得分:2)

Get-WindowsFeature不是PowerShell 5的一部分,而是Server Manager模块的一部分,该模块未安装或加载,因为错误消息明确指出,您尝试执行的命令不可用

使用Import-Module ServerManager导入,或Import-Module -ListAvailable查看是否已安装。

答案 1 :(得分:0)

确保您不尝试通过Powershell(x86)访问Get-ImportModule。不在那里使用常规的Powershell,就可以了。