2010-10-08 16 views
0

我已經編寫了一些Exchange 2010統一消息自動化腳本。我正試圖將UM撥號計劃與UM服務器的關聯自動化。 PowerShell的命令是:set-Umserver cmd的腳本輸入問題讓我

[PS] E:\Scripts>Set-UmServer -id Exchange01 -DialPlans "test1", "test2" 

當我嘗試下面的腳本解決方案:

[PS] E:\Scripts>$str = "`"test1`", `"test2`"" 
[PS] E:\Scripts>Set-UmServer -id Exchange01 -DialPlans $str 

我得到一個錯誤:

The UM dial plan "test1", "test2" doesn't exist. 
+ CategoryInfo   : NotSpecified: (0:Int32) [Set-UmServer], ManagementObjectNotF 
+ FullyQualifiedErrorId : 7AF43AA1,Microsoft.Exchange.Management.Tasks.UM.SetUMServer 

我的感覺是,我不正確地處理變量並且該變量將在「test1」,「test2」「而不是」test1「,」test2「中交換。

任何指導將不勝感激。

問候

喬恩

回答

0

你勞累過度了。 :-)試試這個:

$str = "test1", "test2" 
Set-UmServer -id Exchange01 -DialPlans $str 
+0

謝謝Keith。這給了我需要解決問題的提示。 我結束了使用以下,因爲它給了我更多的靈活性: $ str = @() $ str = $ str +「test1」 $ str = $ str +「test2」 – Arcass 2010-10-11 10:15:49