A koan is a riddle used by Zen Buddhists to help focus the mind during meditation and, with any luck, to help the initiate develop intuitive thinking. Some of the more famous Zen koans include:
"Two hands clap and there is a sound; what is the sound of one hand?"
"What is Buddha?" Dongshan said, "Three pounds of flax."
"What is the meaning of the ancestral teacher's coming from the west?" Zhaozhou said, "The cypress tree in front of the hall."
"Does a dog have Buddha nature or not?" Zhaozhou said, "Wú!"
. You know, you’re right: some of those koans
make about as much sense as most technical documentation, don’t they?
technical documentation, mind you.
There’s also this somewhat lesser-known koan:
“You create several per-user policies in Microsoft Lync Server 2010. How do you know if all, or even any, of these policies are actually being used?”
That’s actually a valid question: what’s the point of creating, and managing, scores of per-user Lync Server policies if you never even
those policies? But how in the world can you tell whether or not any of your per-user policies have actually been assigned to a user (or two)?
As it turns out, it’s pretty easy to determine how many users have been assigned a particular per-user policy. For example, this command returns the number of users who have been assigned the voice policy RedmondVoicePolicy:
That’s cool, but what if you have a whole
of per user voice policies. Do you have to repeat the preceding command time after time after time, running one command per voice policy? As a matter of fact, you do.
This is actually a fairly simple little script. (Yes, we know. But in PowerShell, looks can be deceiving.) What we’re doing here is first creating an empty array named $identities; that’s what the command
$identities = @()
does. We then use
r parameter to return all the voice policies that have an Identity that begins with the string value
; as you well know, any voice policy that has an Identity that begins with
is a per-user policy.
After we return all the per-user voice policies, we set up a foreach loop that strips the
prefix off each Identity; once we’ve done that we can then use
parameter to return the number of users who have been assigned each policy. For example, suppose we have three per-user voice policies:
After stripping off the prefix, we’re left with these policy Identities:
And then, for all intents and purposes, we end up running these three commands:
Which, in turn, gives us back information similar to this:
As you can see, the Tokyo policy has been assigned to a
of users; the other two policies are less-widely used.
Of course, this particular script works only for voice policies. What if you’d like to return this same information for, say, client policies? That’s fine: just search for each instance of
and replace it with
. Give it a try and see what happens.
Hey, guess what: we’re pretty sure we hear one hand clapping out there! Thank you, thank you very much.