Find Last Users to Migrate from OCS to Lync and Excluding Some Users


I had a situation the other day where I needed to identify all users that were still on OCS 2007 R2 that still needed to be migrated to Lync 2010. This was a little more difficult because there was a requirement to filter the list so that a group of users that were using an older third party RCC product were not included in the migration.

The RCC users need to stay on OCS 2007 R2 until the telecom team is able to upgrade the phone system to a newer version that will support RCC with Lync 2010.

The first step was to create a simple text file that includes all of the users’ SIP Addresses that are required to remain on OCS.

The idea behind this script was to do the following:

  1. Identify all users in the company that are enabled for OCS or Lync
  2. Take the SIP Address field, which is prepended with “sip:” and remove the “sip:”
  3. Compare the SIP Address to the Exclusion List
  4. Capture the SIP Address for those not on the Exclusion List
  5. Test if the SIP Address is on OCS or Lync (FYI: OCS users do not have a RegistrarPool attribute)

# Identify all users enabled for OCS or Lync

$OCSList = Get-QADUser -sizelimit 0 -includedproperties “msrtcsip-userenabled”,”msrtcsip-primaryuseraddress” | where {$_.”msrtcsip-userenabled” –eq $true} | select “msrtcsip-primaryuseraddress”

$Null | Out-File MigrationList.txt

$ExcludeList = Get-Content ExcludeList.txt

foreach ($i in $OCSList){

                # Remove Sip:

                $SipAdd = $i.”msrtcsip-primaryuseraddress”

                $SipAdd = $SipAdd -split “sip:”

                $SipAdd = $SipAdd[1]

                # Test if on Exclusion List

                $ExTest = $ExcludeList -ilike $SipAdd


                                $RegPool = (get-csuser $SipAdd).registrarpool

                                # Test if OCS user

                                 if (!$RegPool){

                                                $SipAdd | Out-File -append MigrationList.txt




Another way to get the list of OCS users, that is probably simpler, is to run:

Get-CsUser –resultsize unlimited | Where {$_.RegistrarPool –eq $Null}

Then you could run it through a similar exclusion test. Of course, I didn’t think of this until I got to this point of writing this post. Smile

This entry was posted in Uncategorized. Bookmark the permalink.

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 )

Google+ photo

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

Connecting to %s