Listing the Microsoft Lync Server 2010 Cmdlets

Here’s a question for you: how can you list just the Microsoft Lync Server cmdlets?

That’s actually a pretty good question. After all, Windows PowerShell ships with some 270+ cmdlets and functions, and then Micro­soft Lync Server adds another 540 or so to the mix. How in the world can you identify which cmdlets are generic Pow­erShell cmdlets and which cmdlets belong to Microsoft Lync Server?

And here’s the answer (or at least here’s an an­swer), a command that returns a list of all the Microsoft Lync Server cmdlets (and only the Microsoft Lync Server cmdlets):

Get-Command -module Lync | More

Ah, but what if you want to see only the cmd­lets that have the word voice somewhere in the cmdlet name? No problem; all you have to do is ask:

Get-Command *voice* -module Lync

Or how about all the Microsoft Lync Server cmdlets that use the verb Get:

 

Get-Command -module Lync -verb Get

See how that works? We just include the -Verb parameter followed by the verb of in­terest. (Cmdlet names consist of a verb and a noun: in Get-CsVoicePolicy we have the verb Get and the noun CsVoicePolicy. And before you ask, yes, there is a -Noun parameter as well as -Verb.)

Now here’s a tricky one: what about all the Microsoft Lync Server cmdlets that use the verb Get and that have the word voice somewhere in the cmdlet name? We’ll give you a hint; the following command won’t work:

Get-Command *voice* -module Lync -verb Get

As it turns out, any time you set out to retrieve a specific set of cmdlets (e.g., those that use the verb Get or those that use the noun CsVoicePolicy) you can’t use a wildcard; instead, you have to retrieve all the Get cmdlets or all the CsVoicePolicy cmdlets. In this case, you’re just plain out of luck.

Well, unless you run this command, of course:

Get-Command -module Lync -verb Get| Where-Object {$_.Name -like "*voice*"}

And there you have it.