Advertisement
Advertisement
| 06.26.2008 at 07:19AM PDT, ID: 23518230 |
|
[x]
Attachment Details
|
||
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: |
// create Powershell runspace
Runspace runspace = RunspaceFactory.CreateRunspace();
// open it
runspace.Open();
Command cmd = new Command("Get-Credential");
cmd.Parameters.Add("Credential", "user");
// create a pipeline and feed it the command
Pipeline pipeline = runspace.CreatePipeline();
pipeline.Commands.Add(cmd);
// execute the commnand
Collection<PSObject> results = pipeline.Invoke();
// close the runspace
runspace.Close();
|