Trouble scripting inputs for set-Umserver cmd let
-
28-09-2019 - |
Question
I've writing some Exchange 2010 Unified Messaging automation scripts. I'm trying to automate the assoication of UM dial plans to UM Servers. The powershell command is :
[PS] E:\Scripts>Set-UmServer -id Exchange01 -DialPlans "test1", "test2"
When I try the following scripting solution:
[PS] E:\Scripts>$str = "`"test1`", `"test2`""
[PS] E:\Scripts>Set-UmServer -id Exchange01 -DialPlans $str
I get an error:
The UM dial plan "test1", "test2" doesn't exist.
+ CategoryInfo : NotSpecified: (0:Int32) [Set-UmServer], ManagementObjectNotF
+ FullyQualifiedErrorId : 7AF43AA1,Microsoft.Exchange.Management.Tasks.UM.SetUMServer
My feeling is that I'm handling the variable incorrectly and the variable is swapping in ""test1", "test2"" rather than "test1", "test2".
Any guidance would be greatly appreciated.
regards
Jon
Solution
You're overworking it. :-) Try this:
$str = "test1", "test2"
Set-UmServer -id Exchange01 -DialPlans $str
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow