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 Microsoft Lync Server adds another 540 or so to the mix. How in the world can you identify which cmdlets are generic PowerShell cmdlets and which cmdlets belong to Microsoft Lync Server?
And here’s the answer (or at least here’s an answer), 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 cmdlets 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 interest. (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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.