首先感谢您对此进行审核.
我基本上有一个第三方代理软件,它允许我作为LocalSystem执行PowerShell.这使我可以在没有WinRM等的情况下轻松运行远程PowerShell命令.
我遇到的问题是,在某些服务器上,我无法执行get-WindowsFeature或Add-WindowsFeature.
我试图实现这一目标的一个例子是:
Import-Module ServerManager;
Get-WindowsFeature;
Run Code Online (Sandbox Code Playgroud)
输出如下:
The term 'Get-WindowsFeature' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
Run Code Online (Sandbox Code Playgroud)
如果我在PowerShell窗口中键入相同的命令,或直接调用PowerShell.exe,则返回.我试图弄清楚我们在应用程序中做得不对,但我是PowerShell中最熟悉的人.
加载这些cmdlet需要做些什么特别的事情吗?奇怪的是,Get-Module没有显示任何内容.
谢谢!
回应JBSmith:
Yessir - 看起来像2.0.以下是您提到的命令的结果
>Name Value
>---- -----
>CLRVersion 2.0.50727.6407
>BuildVersion 6.1.7600.16385
>PSVersion 2.0
>WSManStackVersion 2.0
>PSCompatibleVersions {1.0, 2.0}
>SerializationVersion 1.1.0.1
>PSRemotingProtocolVersion 2.1
>
>Name : AppLocker
>Name : Appx …Run Code Online (Sandbox Code Playgroud)