如何才能獲取名稱變量的返回值?Exchange管理Powershell - 如何獲取Name屬性的值?
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();
//創建管道併爲其提供腳本文本 管道管道= myRunSpace.CreatePipeline();
string strScript =「Get-MailboxDatabase」;
//將命令添加到管道的Commands集合。 pipeline.Commands.AddScript(strScript)
Collection results = pipeline.Invoke();