How can I get the return value of only the Name Variable?
RunspaceConfiguration rsConfig = RunspaceConfiguration.Create(); PSSnapInException snapInException = null; PSSnapInInfo info = rsConfig.AddPSSnapIn("Microsoft.Exchange.Management.PowerShell.Admin", out snapInException); Runspace myRunSpace = RunspaceFactory.CreateRunspace(rsConfig); myRunSpace.Open();
//Create pipeline and feed it the script text Pipeline pipeline = myRunSpace.CreatePipeline();
string strScript = "Get-MailboxDatabase";
//Add the command to the Commands collection of the pipeline. pipeline.Commands.AddScript(strScript)
Collection results = pipeline.Invoke();