Click here to Skip to main content
15,883,623 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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..?

1 solution

See[^]. This command is not available on Windows XP.
Share this answer
Richard MacCutchan 21-Feb-14 9:23am    
Quote: "I am using c# in windows xp machine."
Edit your question and show the code that is failing.
@BangIndia 21-Feb-14 9:43am    
using System;
using System.Collections.Generic;
using System.Text;
using System.Management.Automation;
using System.Management.Automation.Runspaces;
using System.Collections.ObjectModel;

Runspace runspace = RunspaceFactory.CreateRunspace();

Pipeline pipeline = runspace.CreatePipeline();
Collection<PSObject> results = pipeline.Invoke();
foreach (object item in pipeline.Error.ReadToEnd())
Console.WriteLine("Error" + item.ToString());


Get-WdsClient -DeviceID 1

above c# code is development in .net 3.5 and powershell 2.0..
@BangIndia 21-Feb-14 10:21am    
For me that Get-WdsClient failing again.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900