Microsoft Teams and Skype for Business News and Thoughts

Tom Arbuthnot MVP
Tom Arbuthnot MCSM Communications

This site uses cookies

Find this blog useful? Please take a second to share, thanks!

Script: Get-LyncDNSSRVRecords.ps1 check a list of domains for possible OCS\Lync federation

Published 01/11/2011 - 7 Comments

A few people in the community, including Julian Bee and Matt Landis are doing a great job of gathering information on what companies are open for Lync federation. Lync federation is one of the real killer features, being able to work with people across companies with IM, Presence, Voice, Video and sharing just like you do with you company colleagues is amazing.

image

The challenge was thrown down to write a script to gather the public DNS info that would suggest companies have Lync or OCS, which can be done with nslookup manually.

image

I thought that was a good idea. Not just to see which large companies are using Lync or OCS (and it’s quite a few btw), but also for any companies using Lync to scan the domains of the companies they work with to see who might be available for federation.

So I set about doing it in PowerShell. It was actually a bit of a challenge as [System.Net.Dns] doesn’t have a method to look up SRV records. Fortunately a community member had it covered with a dns module. Thanks to Joel ‘Jaykul’ Bennett.

So here is a script that takes a CSV list of domains and checks them for  _sip._tls.domain.com and _sipfederationtls._tcp.domain.com records and writes the results to a text file.

Note: This is checking public DNS which the domain owner has chosen to publish, but please use it responsibly and at your own risk.

Feedback always welcome

Download the script here Other useful Lync scripts can be found here

 

#
# Get-LyncDNSSRVrecords.ps1 Tom Arbuthnot lyncdup.com
#
# This script scans a list of domains for SRV records that may indicate they may be running OCS/Lync and could
# be possible partners for federation. It writes the results to a text file
# Note: These are public DNS records, this is not getting anything not already published by the domain owner
# Use at your own risk, get the domain providers permission, look both ways before crossing the road.
#
# Example use: Take a list the common domains your company emails and check if any of them may be using OCS\Lync
#
# It expects a CSV with a single column titled domains
# This script requires PoshNet.dll from http://huddledmasses.org/powershell-dig-nslookup-cmdlet/ thanks Joel 'Jaykul' Bennett
#
# Feedback always welcome
########################
# Variables to set
$domainscsvlist = 'C:\Tom\domainstotest.csv'
$resultstxtfile = 'C:\Tom\results.txt'
$poshnetdll = 'C:\Tom\PoshNet.dll'
##########################
Import-Module $poshnetdll
$domains = Import-Csv $domainscsvlist
foreach ($row in $domains)
{
$domaintotest = $row.domain
$siptlscheck = Get-Dns _sip._tls.$domaintotest srv | select -ExpandProperty additionals | ft
$sipfederationtlscheck = Get-Dns _sipfederationtls._tcp.$domaintotest srv | select -ExpandProperty additionals | ft
if ($siptlscheck -ne $null)
{
Write-host SIP TLS Records found for $domaintotest
$domaintotest | Out-File -append C:\Tom\results.txt
"_sip._tls.$domaintotest" | Out-File -append C:\Tom\results.txt
$siptlscheck | Out-File -append C:\Tom\results.txt
}
if ($sipfederationtlscheck -ne $null)
{
Write-Host SIP Federation TLS Records found for $domaintotest
$domaintotest | Out-File -append C:\Tom\results.txt
"_sipfederationtls._tcp.$domaintotest" | Out-File -append C:\Tom\results.txt
$sipfederationtlscheck | Out-File -append C:\Tom\results.txt
}
else
{
Write-Host No records found for $domaintotest
}
$siptlscheck = $null
$sipfederationtlscheck = $null
}
Write-Host 'Checks complete'
Tom Arbuthnot

Tom Arbuthnot

Principal Solutions Architect at Modality Systems
Tom Arbuthnot is Principal Solutions Architect at Unified Communications specialist Modality Systems. He is a Microsoft Certified Master and MVP, blogger, regular on The UC Architects Podcast, and speaker at events including Microsoft TechEd and Ignite. He co-runs The Microsoft UC User Group London.

7 comments

Script: Get-LyncDNSSRVRecords.ps1 check a list of domains for possible OCSLync federation | Lync’d Up « JC’s Blog-O-Gibberish - 01/11/2011 Reply

[…] for possible OCSLync federation | Lync’d Up Posted on November 1, 2011 by johnacook http://tomtalks.uk/2011/11/script-get-lyncdnssrvrecords-ps1-check-a-list-of-d… Share this:StumbleUponDiggRedditLike this:LikeBe the first to like this […]

Julian Bee - 04/11/2011 Reply

Thanks for the mention. Federation really is a game-changer, and that script is a fantastic tool. Nice work!

Brief Review of 2011, more exciting stuff ahead in 2012 | Lync'd Up - 31/12/2011 Reply

[…] A PowerShell script I wrote to scan domains for possible Lync Federation […]

Interview with a Lync Pro: Tom Arbuthnot - NextHop - Site Home - TechNet Blogs - 24/02/2012 Reply

[…] and Lync. I’ve had really good feedback on posts such as Lync PowerShell Cmdlet Mind Maps and PowerShell Script to check domains for Lync Federation, which keeps me motivated. The blog is currently averaging over ten thousand unique hits a month, […]

Jeff - 05/10/2015 Reply

So I know this script os 4 years old… Hoping I will still get an answer.

I have changed some of the params for the records to fetch. I can run the lookups fine from NSLookup, but I am not receiving the expected results when running this script.

I have even set the IP for our internal DNS on the get-dns script.

Leave a Reply:


close

Weekly Email Update 
of all the key 
Microsoft Teams and Skype for Business News
every Tuesday

No Spam ever, I promise - Tom