Aren’t the Filter parameter and the Enabled attribute on the Get-CsUser cmdlet redundant? Doesn't Get-CsUser always return all the users who have been enabled for Lync Server?
Yes, Get-CsUser always returns all the users who have been enabled for Lync Server.
Except, of course, when it doesn't.
What do we mean by that? Here's what we mean by that. When you install Lync Server, the Enabled attribute is added to each of your user accounts. As shown in the table of users below, that attribute can have one of three possible values:
Enabled for Lync Server
Lync Server account temporarily disabled
Not enabled for Lync Server
As you can see, both Ken Myer and Pilar Ackerman have been enabled for Lync Server. However, Ken's Lync Server account is active, which means he can use that account to log on to Lync Server. Pilar's account, by contrast, has been temporarily disabled: it's a valid Lync Server account, but she can't currently use that account to log on to Lync Server. How do we know whether a Lync Server account can be used or not? That's easy: if the Enabled attribute is True then the account can be used. If the Enabled attribute is False, then it can't be used, at least not at the moment.
. And if you've
enabled for Lync Server, like poor April Reagan, then your Enabled attribute will be set to a Null value. For more information, see the article
When is a Boolean Not a Boolean?
So what does all that have to do with the Get-CsUser cmdlet and the Filter parameter? Well, called by itself, Get-CsUser returns all the users who have been enabled for Lync Server, regardless of whether or not their account is active. Consider this command, which returns the DisplayName and Enabled attribute values for all your Lync Server users:
Get-CsUser | Select-Object DisplayName, Enabled
That's going to return data that looks like this:
Now, suppose we're interested only in Lync-enabled users who have active accounts.
where the Filter parameter and the Enabled attribute come in handy:
Like we said, we're interested only in those Lync-enabled users who can actually log on to the system. That means that the command we just showed you should filter out Pilar Ackerman and, lo and behold, it does:
Or we can go the other direction, and look at only those Lync-enabled users who
currently log on to the system?
. Actually it doesn't just
to work, it
Which simply means this: the Filter parameter, and the Enabled property, is
useful if you need to draw a distinction between Lync-enabled users who have active accounts and Lync-enabled users who have inactive accounts. If you don't need to draw that distinction then you don't need to use the Filter parameter and the Enabled property.