Click here to Skip to main content
15,880,427 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am using vs 2008 in windows server 2012.

code :

InitialSessionState iss = InitialSessionState.CreateDefault();

RunspaceConfiguration runspaceConfiguration = RunspaceConfiguration.Create();

Runspace runspace = RunspaceFactory.CreateRunspace(runspaceConfiguration);
runspace.Open();

RunspaceInvoke scriptInvoker = new RunspaceInvoke(runspace);

Pipeline pipeline = runspace.CreatePipeline();

//Here's how you add a new script with arguments
pipeline.Commands.Add("Out-String");
Command myCommand = new Command("Get-WdsClient");
pipeline.Commands.AddScript("Get-WdsClient");

pipeline.Invoke();



That command is available only in 64 bit powershell. i have build my exe in 64 bit . then also its giving commandlet not available. but when i open manually and entering the powershell commandlet its working.
Posted

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