Archive

Posts Tagged ‘Lync Management Shell’

One Liner – See Number Of Connected Users, Endpoints On A Lync Front End Server

January 22nd, 2015 5 comments

A question went around an internal DL at work today asking if anyone knew off the top of their head the name of performance counters that show connected users and endpoints. While digging up the answer, I started thinking – this would be a great little one liner.

My esteemed colleague Ron Cook (@roncook925) beat me to supplying the answer to the DL question. The two counters are:

LS:USrv – Endpoint Cache\USrv – Active Registered Endpoints
LS:USrv – Endpoint Cache\USrv – Active Registered Users

Endpoints is always higher than users, in my experience. There are always some users who are connected via mobile devices and rich client, or via OWA, or LPE. So I like to query both.

PowerShell has a great cmdlet called Get-Counter which, as you can guess, can query performance counters. There’s a pretty good tutorial on how to retrieve perfmon counter data for Lync related counters by the Lync PowerShell group at Microsoft in How Do We Love Performance Counters” Let Us Count the Ways. So let’s take a look at how we can get the data we need.

In this case, we’ll query the two counters mentioned above with one line. This is supported in Get-Counter by just separating the counters with a comma. We’ll select an expanded property called CounterSamples, which holds the data we need (among other info). And lastly, we’ll output the path (counter name), and something called the CookedValue, which is the actual counter value contained within CounterSamples. I know, CookedValue sounds like it could be just made up numbers, like those you get from a shifty accountant. But it is truly the value we want.

Plug this into your console as one long line:

Get-Counter "\LS:USrv - Endpoint Cache\USrv - Active Registered Endpoints","\LS:USrv - Endpoint Cache\USrv - Active Registered Users" | Select-Object -ExpandProperty CounterSamples | Format-Table Path,CookedValue -Auto

That will give you a quick point-in-time snapshot of the number of users and endpoints connected to the front end, as shown below.

perfmon

The blurred text is just the front end name. If you’d like to query a remote front end, just tack on the ComputerName parameter, such as:

Get-Counter "\LS:USrv - Endpoint Cache\USrv - Active Registered Endpoints","\LS:USrv - Endpoint Cache\USrv - Active Registered Users" -ComputerName frontend.contoso.com | Select-Object -ExpandProperty CounterSamples | Format-Table Path,CookedValue -Auto

For those wondering why I’m using Format-Table and the -Auto parameter, it’s because the counter path value is so long that it would otherwise get truncated short enough to where you wouldn’t know which counter was tied to which value.

Script: Get-CsUpdateVersion.ps1 – See the Cumulative Update Level Of All Lync/Skype for Business Servers

May 2nd, 2014 45 comments

Description

My work at Modality Systems often has me doing health checks for customer Lync environments. These can be due to customer requests, or as part of our onboarding for new managed support customers. If you’ve ever had an Active Directory Risk Assessment Program (ADRAP) or Exchange Risk Assessment Program (ExRAP), it’s quite similar. Lots of tasks to run, lots of data to sift through. So it’s always beneficial to standardize and automate the steps to get the data. The same is the case when you’re responsible for your own environment and want to ensure good health.

Just like Get-CsDatabaseUpdateStatus.ps1, Dave Howe from the Lync product group and I teamed up to automate something. In this case, it’s looking at what Cumulative Updates are installed on each server throughout a Lync environment. This script queries each pool, then finds what servers are part of that pool, and queries each server to find the CU that’s installed. It then provides an easy to read output of the entire environment (with exceptions) for easy review. As shown below, we see three multi-server pools, the version number and “friendly” Cumulative Update info.

PS C:\> .\Get-CsUpdateVersion.ps1

ComputerName   : sjc-edge01
PoolFqdn       : sjc-edge01.contoso.com
Version        :
Product        :
Update         :
FriendlyResult : PSRemoting failure
UpToDate       :
UpdateUrl      :

ComputerName   : sjc-fe01
PoolFqdn       : sjc-fe01.contoso.com
Version        : 6.0.9319.272
Product        : Skype for Business Server 2015
Update         : CU4 - 11/04/2016
FriendlyResult : Skype for Business Server 2015 CU4 - 11/04/2016
UpToDate       : False
UpdateUrl      : http://support.microsoft.com/kb/3199093

ComputerName   : sjc-pc01
PoolFqdn       : sjc-pc01.contoso.com
Version        : 6.0.9319.272
Product        : Skype for Business Server 2015
Update         : CU4 - 11/04/2016
FriendlyResult : Skype for Business Server 2015 CU4 - 11/04/2016
UpToDate       : False
UpdateUrl      : http://support.microsoft.com/kb/3199093

The script works fine with Standard Edition servers as well.

In the first example, you see that the first two servers show “PSRemoting failure”. This is because the script uses PowerShell Remoting to connect to each remote server to query information (see installation notes below). PSRemoting doesn’t really work the same when dealing with non-domain joined machines, such as the first two, which are edge servers. So the script isn’t able to communicate with them via PSRemoting, and flags them. If the script can’t ping a server, it will show as “offline”. The friendly name of the CU shown is coded in the online XML file that the script queries. So I’ll update it each time a new CU is released.

By default, the script checks all pools. But you can specify a single pool by using the -PoolFqdn parameter.

Syntax

Get-CsUpdateVersion.ps1 [[-PoolFqdn] ] [-WhatIf] [-Confirm]

Installation

This script uses PowerShell Remoting to query remote servers. PSRemoting is enabled by default on Windows Server 2012 and later, but disabled by default on 2008 R2. To enable PSRemoting on 2008 R2 servers, see Enable-PSRemoting. The script requires Internet access on the machine the script is running on. This is to query the XML file containing the update information.

Execution Policy: Third-party PowerShell scripts may require that the PowerShell Execution Policy be set to either AllSigned, RemoteSigned, or Unrestricted. The default is Restricted, which prevents scripts – even code signed scripts – from running. For more information about setting your Execution Policy, see Using the Set-ExecutionPolicy Cmdlet.

Donations

I’ve never been one to really solicit donations for my work. My offerings are created because *I* need to solve a problem, and once I do, it makes sense to offer the results of my work to the public. I mean, let’s face it: I can’t be the only one with that particular issue, right? Quite often, to my surprise, I’m asked why I don’t have a “donate” button so people can donate a few bucks. I’ve never really put much thought into it. But those inquiries are coming more often now, so I’m yielding to them. If you’d like to donate, you can send a few bucks via PayPal at https://www.paypal.me/PatRichard. Money collected from that will go to the costs of my website (hosting and domain names), as well as to my home lab.

Assumptions

None

Download

v3.9 – 03-08-2017 – Get-CsUpdateVersion.v3.9.zip

v3.8 – 02-14-2017 – Get-CsUpdateVersion.v3.8.zip

v3.7 – 02-05-2017 – Get-CsUpdateVersion.v3.7.zip

v3.6 – 01-06-2017 – Get-CsUpdateVersion.v3.6.zip

v3.5 – 11-28-2016 – Get-CsUpdateVersion.v3.5.zip

v3.4 – 11-12-2016 – Get-CsUpdateVersion.v3.4.zip

v3.3 – 08-31-2016 – Get-CsUpdateVersion.v3.3.zip

v3.2 – 07-15-2016 – Get-CsUpdateVersion.v3.2.zip

v3.1 – 07-05-2016 – Get-CsUpdateVersion.v3.1.zip

v3.0 – 04-21-2016 – Get-CsUpdateVersion.v3.0.zip

v2.9 – 04-07-2016 – Get-CsUpdateVersion.v2.9.zip

v2.8 – 01-26-2016 – Get-CsUpdateVersion.v2.8.zip

v2.7 – 12-14-2015 – Get-CsUpdateVersion.v2.7.zip

v2.6 – 11-17-2015 – Get-CsUpdateVersion.v2.6.zip

v2.5 – 11-11-2015 – Get-CsUpdateVersion.v2.5.zip

v2.4 – 10-03-2015 – Get-CsUpdateVersion.v2.4.zip

v2.3 – 09-09-2015 – Get-CsUpdateVersion.v2.3.zip

v2.2 – 07-14-2015 – Get-CsUpdateVersion.v2.2.zip

v2.1 – 06-21-2015 – Get-CsUpdateVersion.v2.1.zip

v2.0 – 05-12-2015 – Get-CsUpdateVersion.v2.0.zip

v1.9 – 02-19-2015 – Get-CsUpdateVersion.v1.9.zip

v1.8 – 02-09-2015 – Get-CsUpdateVersion.v1.8.zip

v1.7 – 01-01-2015 – Get-CsUpdateVersion.v1.7.zip

v1.6 – 12-12-2014 – Get-CsUpdateVersion.v1.6.zip

v1.5 – 11-21-2014 – Get-CsUpdateVersion.v1.5.zip

v1.4 – 09-24-2014 – Get-CsUpdateVersion.v1.4.zip

v1.3 – 09-02-2014 – Get-CsUpdateVersion.v1.3.zip

v1.2 – 08-07-2014 – Get-CsUpdateVersion.v1.2,zip

v1.1 – 06-02-2014 – Get-CsUpdateVersion.v1.1.zip

v1.0 – 05-02-2014 – Get-CsUpdateVersion.v1.0.zip

Changelog

See the changelog for information on what’s changed/included in each version.

Changelog: Get-CsUpdateVersion.ps1

May 2nd, 2014 3 comments

This is the changelog page for Get-CsUpdateVersion.ps1. You will find a complete list of released versions, their dates, and the features and issues addressed in each. Please refer to the script’s main page for more information including download links, installation details, and more.

v3.9 – 03-08-2017

  1. Converted script to return PowerShell objects instead of the previously used write-host and write-output. While this sheds the nicely colored output, it makes it far more effective, and better aligns with PowerShell best practices.
  2. Converted the script to ONLY use the online data for version info. This means that every time a new update is released for Lync Server 2010, Lync Server 2013, and/or Skype for Business Server 2015, I don’t need to release a new version of the script – merely update the hosted XML file containing the data. This also means that users of the script won’t need to always download a new version. This doesn’t mean there will be no further updates to the script.
  3. Fixed an issue where when using the online data (available in the last couple of versions using the -online switch) doesn’t check the online data for each server (and due to a glitch, sometimes twice for each server). The data is retrieved once when the script starts.
  4. Added some more verbose output, as large environments or those with slower connections to remote servers, or those with unreachable servers would slow the script down. Running it with the -verbose option will at least give the user some running information.
  5. Some code cleanup and optimization.

v3.8 – 02-14-2017

  1. added version 6.0.9319.277 for Skype for Business Server

v3.7 – 02-05-2017

  1. Code cleanup/optimization
  2. added version 5.0.8308.984 for Lync Server 2013

v3.6 – 01-06-2017

  1. Added 5.0.8308.977 for Lync Server 2013

v3.5 – 11-28-2016

  1. Added 5.0.8308.974 for Lync Server 2013
  2. Fixed an issue with the Get-UpdateInfo function that was causing unexpected “PSRemoting Failure” errors later in the script.
  3. Added the -online option, which will query update information from an online source instead of the info within the script itself. If this pans out ok, it will be the default method in future versions. It does require that the machine running the script have Internet access.

v3.4 – 11-12-2016

  1. Added new update mechanism
  2. Added some logging
  3. Added 4.0.7577.728 for Lync Server 2010
  4. Added 6.0.9319.272 for Skype for Business Server 2015

v3.3 – 08-31-2016

  1. Added build 5.0.8308.965 for Lync Server 2013

v3.2 – 07-15-2016

  1. Added build 5.0.8308.956 for Lync Server 2013

v3.1 – 07-05-2016

  1. Added build 6.0.9319.259 for Skype for Business Server 2015

v3.0 – 04-21-2016

  1. Added build 4.0.7577.726 for Lync Server 2010
  2. Added build 5.0.8308.949 for Lync Server 2013

v2.9 – 04-07-2016

  1. Added build 6.0.9319.235 (03/18/2016) – Thanks to Geir Age Moretensen for pointing it out

v2.8 – 01-26-2016

  1. Added support for Lync Server 2013 build 5.0.8308.945 (01/03/2016) – Thanks to Geir for pointing it out

v2.7 – 12-14-2015

  1. Added support for Lync Server 2013 build 5.0.8308.941 (12-14-2015)

v2.6 – 11-17-2015

  1. Added support for Skype for Business Server 2015 build 6.0.9319.102 (11/17/2015).

v2.5 – 11-11-2015

  1. Added support for Skype for Business Server 2015 build 6.0.9319.88 (9/26/2015).
  2. Removed references to Skype for Business Server 2015 Cumulative Updates due to general confusion.

v2.4 – 10-03-2015

  1. Added support for Lync Server 2013 CU15 (5.0.8308.927)
  2. Added support for Lync Server 2013 CU14 (5.0.8308.927). Thanks to Geir for submitting the info.
  3. added -SkipUpdateCheck to skip update check

v2.3 – 09-09-2015

  1. Added support for Skype for Business Server 2015 CU2 (6.0.9319.72)
  2. Added default of “Unknown version”. Thanks to Bernard for the idea.
  3. Code optimization
  4. server name is now only displayed as NetBIOS name to help reduce wordwrap (was previously FQDN). It’s red if the version is not the latest (or unknown), and green if it’s the latest version.

v2.2 – 07-14-2015

  1. Added support for Lync Server 2010 CU16 (4.0.7577.713) – Thanks to Martin for pointing it out.
  2. Added support for Lync Server 2013 CU13 (5.0.8308.920)

v2.1 – 06-21-2015

  1. Added support for Skype for Business Server 2015 RTM (6.0.9319.0)
  2. Added support for Skype for Business Server 2015 CU1 (6.0.9319.45)

v2.0 – 05-12-2015

  1. fixed typo for Lync Server 2010 CU15. Thanks to @greiginsydney for pointing it out.
  2. Updated Lync Server 2013 CU 11 – original download was 5.0.8308.871, but current download of CU 11 shows as 5.0.8308.872
  3. Added support for Lync Server 2013 CU 12 (5.0.8308.887)

v1.9 – 02-19-2015

  1. Added Lync Server 2013 CU 11 (5.0.8308.871)

v1.8 – 02-09-2015

  1. Added Lync Server 2010 CU 15 (4.0.7577.710)

v1.7 – 01-01-2015

  1. Added Lync Server 2010 CU 13 (4.0.7577.707)
  2. Added Lync Server 2010 CU 14 (4.0.7577.708)
  3. Added Lync Server 2013 CU 10 (5.0.8308.866)

v1.6 – 12-12-2014

  1. Added Lync Server 2013 CU 9 (5.0.8308.857)

v1.5 – 11-21-2014

  1. Added Lync Server 2013 post CU5 (5.0.8308.803)
  2. Added Lync Server 2013 CU 7 (5.0.8308.831)
  3. Added Lync Server 2013 CU 8 (5.0.8308.834)

v1.4 – 09-24-2014

  1. Added Lync Server 2013 CU6

v1.3 – 09-02-2014

  1. Added Lync Server 2010 CU12

v1.2 – 08-07-2014

  1. Added script check for updates. This is key because each time a new cumulative update comes out, the script will be updated with version info
  2. Added some preliminary code around getting version info for OWAS servers. Need to find a graceful way of getting the server names in a OWAS farm.
  3. Added Lync Server 2013 CU5

v1.1 – 06-02-2014

  1. Tweaked the PSRemoting code block for retrieving version numbers per Chris Irons. This should resolve unexpected results when querying Lync Server 2010 pools.
  2. Filtered out “Debugging Tools” “Resource Kit Tools” “Best Practices Analyzer” and “Meeting Room Portal” which could have a higher version number and cause incorrect results – thanks to Andy G for pointing that out.
  3. Shortened some of the output text to reduce the likelihood of word wrap.

v1.0 – 05-02-2014

  1. Initial version

Changelog: Get-CsDatabaseUpdateStatus.ps1

April 30th, 2014 No comments

This is the changelog page for Get-CsDatabaseUpdateStatus.ps1. You will find a complete list of released versions, their dates, and the features and issues addressed in each. Please refer to the script’s main page for more information including download links, installation details, and more.

v1.2 – 02-24-2018

  1. Updated Write-Log to v3.4
  2. Updated Get-UpdateInfo to v1.5
  3. Updated Set-ModuleStatus to v1.6
  4. Code cleanup per recommendations from refactoring

v1.1 – 04-30-2014

  1. Fixed an issue with mangled parameter blocks. Thanks to Dave for reporting it.

v1.0 – 04-30-2014

  1. Initial version

All Lync 2010 Cmdlets and the Default RBAC Roles That Can Use Them

June 1st, 2011 No comments

A customer asked for some documentation as to the various Lync cmdlets, what they do, and who can do them. Knowing that there are hundreds of cmdlets for Lync, this was a daunting task. Thank goodness for PowerShell, copy & paste, and some macros!

I used the script by Cezar Ungureanasu at http://blogs.technet.com/b/csps/archive/2010/06/10/scriptlistrbacrolesandcmdlets.aspx which shows you how to find out what cmdlets are available to specific default RBAC roles. I ran that in a virgin environment and captured the data to a .tsv file. I found a page from Microsoft at http://blogs.technet.com/b/csps/archive/2010/07/16/refallcmdlets.aspx which includes all 546 of the Lync cmdlets, a link to their associated Technet page, and a brief description. I merged that data into the .tsv file, and then added a formula that can be used to confirm what RBAC roles each cmdlet can be used by (in case an environment has been changed from the default settings). All of that was rolled into an Excel spreadsheet that can now be downloaded at the link below. This was perfect for the customer.

Recent updates include cmdlets added in Cumulative Update 4, as well as a new column indicating when the cmdlets were added to Lync. I’ll update that as I get more information.

Let me know if there are any issues, or if you can think of something I should add.

Download

v1.1 DefaultCmdletsByRBACRolev1.1.zip (11-20-2011)

v1.0 DefaultCmdletsByRBACRole.zip (06-01-2011)