One of These Things is Not Like the Others: Challenge 5 Answer

One of These Things is Not Like the Others: Challenge 5


Last week’s challenge was all about data types. (And yes, we suppose the challenge would have been easier had we told you a long time ago that the thing was all about data types.) For the week 5 challenge, we showed you the following Lync Server PowerShell parameters/properties and asked you to tell us which one was not like the others:







The answer we came up with (and the answer that most of you came up with) was the DisplayName parameter used with Set-CsSite.


Note. And yes, as it was pointed out to us, we did kind of screw things up a little when presenting the challenge. Because we were talking about parameters, we should have formatted each row in the table more like this: Set-CsSite –DisplayName. So why didn’t we do that? Because … well, just because.


Besides, if we knew what we were doing, we wouldn’t be technical writers at Microsoft, would we?


At any rate the Prefixes, PstnUsages, and SimpleUrl parameters are all alike because they share the same data type: they all have the data type PSListModifier. By contrast, the DisplayName parameter has a String data type.


If you’re wondering what the heck a data type even is, the data type is used to help define the values that can used with a given parameter/property. For example, suppose you had a property called DateOfHire, a property that contained the date a person was hired. Most likely you’d want to give this property a date-time data type. Why? Because you only want people to enter a date for that property; you don’t want people entering Red or False or 41.95 as the DateOfHire. When you configure a data type, any invalid entry (like Red or False or 41.95) will cause an error, and the value will not be set.


As for the PSListModifer, that’s a special data type that simply means we’re dealing with a multi-valued property: a property that can contain more than one value. For example, suppose we run this command, which tries to assign two different PSTN usages to a single voice policy:


Set-CsVoicePolicy –Identity RedmondVoicePolicy –PstnUsages “local”, “long distance”


Is that going to work? You bet it is; that’s because PstnUsages can accept multiple values. However, the DisplayName parameter can’t accept multiple values; that means that this command is going to fail:


Set-CsSite –Identity site:Redmond –DisplayName “Redmond”, “Redmond Site”


Instead, you’re going to get an error message like this one:


Set-CsSite : Cannot convert ‘System.Object[]’ to the type ‘System.String’ required by parameter ‘DisplayName’.


That simply means that we tried to pass multiple values to the DisplayName parameter, and DisplayName can’t handle multiple values. Thus the command blows up.


So how do you know the data type for a parameter? Well, the easiest way is probably just to look at the help. For example, this command gives you some information, including data type, for the DisplayName parameter:


Get-Help Set-CsSite –parameter “DisplayName”


And if you want really detailed information about a single parameter you could run a command like this one:


Get-Command Set-CsSite | Select-Object –ExpandProperty ParameterSets | Select-Object –ExpandProperty Parameters | Where-Object {$_.Name –eq “DisplayName”}


Pretty cool, huh?


Oh, and don’t forget: we have a brand-new challenge (Challenge 6) waiting for you. Enjoy!


Challenge Home


Skip to main content