需要有关使用c#执行Powershell命令行执行的帮助 [英] Need help on Powershell commandlet execution using c#

查看:103
本文介绍了需要有关使用c#执行Powershell命令行执行的帮助的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在windows xp机器上使用c#。

我尝试执行commaneletGet-WdsClient(仅在2012服务器上启用wds服务启用机器时)。



我的exe程序正在排除我机器中可用的注释...但是当我尝试执行Get-WdsClient注释时,它通过异常说明。



异常系统.Management.Automation.CommandNotFoundException:术语'Get-W

dsClient'不被识别为cmdlet,函数,脚本文件或o

perable program的名称。检查名称的拼写,或者是否包含路径,验证路径是否正确并再试一次。

在System.Management.Automation.CommandDiscovery。 LookupCommandInfo(String com

mandName,CommandOrigin commandOrigin)

在System.Management.Automation.CommandDiscovery.LookupCommandProcessor(Strin

g commandName,CommandOrigin commandOrigin, Nullable`1 useLocalScope)

在System.Management.Automation.ExecutionContext.CreateCommand(字符串命令



在System.Management.Automation。 CommandNode.CreateCommandProcessor(Int32&ind

ex,E​​xecutionContext context)

在System.Management.Automation.CommandNode.AddToPipeline(PipelineProcessor p

ipeline, ExecutionContext上下文)

在System.Management.Automation.PipelineNode.Execute(数组输入,管道输出

管道,ArrayList和resultList,ExecutionContext上下文)

在System.Managemen t.Automation.ParseTreeNode.Execute(数组输入,管道输出

tPipe,ExecutionContext上下文)

在System.Management.Automation.AssignmentStatementNode.Execute(数组输入,

Pipe outputPipe,ExecutionContext context)

at System.Management.Automation.StatementListNode.ExecuteStatement(ParseTreeN

ode statement,Array input,Pipe outputPipe,ArrayList& resultList,ExecutionCon

文字上下文)







如何解决这个问题问题??

I am using c# in windows xp machine.
I am try to execute the commanelet "Get-WdsClient"(which is avaiable only in 2012 server when wds service enabled machine).

My exe is excutingall the comments which is avaialble in my machine.. but when i try to execute the Get-WdsClient comment its throughing exception saying that.

Exception System.Management.Automation.CommandNotFoundException: The term 'Get-W
dsClient' is not recognized as the name of a cmdlet, function, script file, or o
perable program. Check the spelling of the name, or if a path was included, veri
fy that the path is correct and try again.
at System.Management.Automation.CommandDiscovery.LookupCommandInfo(String com
mandName, CommandOrigin commandOrigin)
at System.Management.Automation.CommandDiscovery.LookupCommandProcessor(Strin
g commandName, CommandOrigin commandOrigin, Nullable`1 useLocalScope)
at System.Management.Automation.ExecutionContext.CreateCommand(String command
)
at System.Management.Automation.CommandNode.CreateCommandProcessor(Int32& ind
ex, ExecutionContext context)
at System.Management.Automation.CommandNode.AddToPipeline(PipelineProcessor p
ipeline, ExecutionContext context)
at System.Management.Automation.PipelineNode.Execute(Array input, Pipe output
Pipe, ArrayList& resultList, ExecutionContext context)
at System.Management.Automation.ParseTreeNode.Execute(Array input, Pipe outpu
tPipe, ExecutionContext context)
at System.Management.Automation.AssignmentStatementNode.Execute(Array input,
Pipe outputPipe, ExecutionContext context)
at System.Management.Automation.StatementListNode.ExecuteStatement(ParseTreeN
ode statement, Array input, Pipe outputPipe, ArrayList& resultList, ExecutionCon
text context)



how to solve this issue..?

推荐答案

请参阅 http: //technet.microsoft.com/en-us/library/dn283432.aspx [ ^ ]。此命令在Windows XP上不可用。
See http://technet.microsoft.com/en-us/library/dn283432.aspx[^]. This command is not available on Windows XP.


这篇关于需要有关使用c#执行Powershell命令行执行的帮助的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆