Simple Lync Environment Report Script – PowerShell

Special Thanks: goes out for Mr. Jean Pavel my manager in 1&1 Internet AG for his contributions & help in writing this script, and maybe keeping my Job after what I wrote down 🙂


Important Note:To be able to use this script you need to have Synthetic Transactions account configured, you can follow instructions in this post to do that.

So I have been asked by my Manager to find a way to get a Lync Environment Report, and as we don’t have any Monitoring tool in our infrastructure that support Lync, as well as his requirements was clear

Report that tell him status of services, servers, number of users, licensing…etc.

So of course my first thought was “PowerShell Script”, so I asked my worst friend Google for help, and I found the following Lync Environment report which is an amazing script and give you detailed information about your Lync Environment, but not what a Managers are usually looking for, Managers want a nice, colorful HTML table email to be send to them daily that show them with one look summary about what happening with their Lync.

So I know that there are number of Lync PowerShell Command lines that test number of Lync Functionalities e.g.

  • Test-CSim
  • Test-CSp2pav
  • Test-CSPresence
  • Test-CSGroupIM

And so on, list is long, so I start writing functions that test what is provided by our Lync infrastructure (No PSTN calls are done with our Lync so couldn’t add functions that can test peer-to-peer PSTN calls , Normalization Rules, Trunk configurations….etc.)

So Lync Environment Report test the following from the client side

  1. Test Peer-to-Peer A/V , A/V conferencing , Dialing Conferencing
  2. Test IM and Group IM
  3. Test Registration with our Pool
  4. Test Presence.

Also will check for AddressBook Services

  1. Downloading address book internally
  2. Downloading address book externally
  3. Address book internal query
  4. Address book external query

Note: In the screen shoot below I made the result of the test “Failure” to show you how failure status will be shown.

From Server Side Lync Environment Report checks the following

  1. Check Lync windows services on both Frontend Servers
  2. Check Lync windows services on Mediation Servers
  3. Check Lync windows services on Monitoring Servers
  4. Check Lync Patch Level
  5. Check Lync CS Management Store Replication Status

From the Money side (Most important part for Managers ) the script check for licensing , as you might already know in Lync 2010 there is no direct way to know your Licensing usage, where in Lync 2013 there is the command line “Get-CSClientAccessLicensie”.

So I had to be tricky in this section to get a final info about what and how many CALs are being used using the concept that

  • Standard CALs = Lync Users on Lync Server
  • PLUS CALs = Enterprise Voice Enabled users
  • Enterprise CALs = Lync Users with Conferencing policy using PSTN

So I was able to include the following in the Lync Environment Report:

  1. Check Lync Standard CALs
  2. Check Lync Enterprise CALs
  3. Check Lync PLUS CALs

If you have little PowerShell script skills (not like me , I don’t say i’m even good in scripting 😛 ) and know your Lync PowerShell cmdlet very well, writing a script like this will not take more than couple of hours to finish.

It took me a week… asking why? because the HTML table result provided by our beloved PowerShell is … to be honest “Ugly”, and you must have HTML or CSS fair skills to be able to format your final table.

Lucky me, Jean does, and he showed me enough information on how to write HTML and CSS table codes.

Took me two day to learn how to implement CSS codes into PowerShell and the result was good (at least for a poorly skilled scripting guy like me)


So again you must know basic PowerShell Scripting skills to be able to use the Script.

I added inside as many notes as I can about sections that will need to be changed

  1. Editing the Variable $poolname = “your Lync pool FQDN”
  2. Editing the –computername = “your Front end servers or mediation servers or Monitoring…etc. whatever you want to test”
  3. Editing the To & From emails in the Sending email Function
  4. Editing the “smtpserver” value to point to your CAS/HT server.

Script is Version 1.0, and will keep cleaning it and editing till it better the sooner I learn something new I will reflect it in the script, also if you have more skills , HTML CSS skills that can make the script better please share it with the Lync world and don’t be selfish 🙂

Hope it help anyone out there looking for Lync Environment Report script, if any help or explanation is needed please leave a comment.

Get Script From Here



Author: Lyncdude

A Senior Service Engineer with more than 9 years of experience in Microsoft Exchange and Microsoft Lync Server / Skype for Business. Egyptian guy lives and works in Frankfurt - Germany. what is written in this blog is my own opinion and thoughts, not my employer and does not reflect their opinion

3 thoughts on “Simple Lync Environment Report Script – PowerShell”

    1. Thanks a lot, its not Fancy But it get the job done.
      I’m editing some parts to use over Lync 2013 mainly the Lync CALs part using Get-CSClientAccessLicense cmdlet.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: