Document Lync Server IP’s

I had the need to generate a list of all the IP addresses of our Lync environment. Unlike the screenshot’s below, the production environment I work in has hundreds of Lync servers scattered all around. So off to PowerShell I went and I whipped up this simple script.

start-transcript
$ServersList = Get-CsManagementStoreReplicationStatus
 Foreach ($Server in $ServersList)
 {
 $HostAddress = [System.Net.Dns]::GetHostAddresses($Server.ReplicaFQDN)
 write-host $Server.ReplicaFQDN - $HostAddress.IPAddressToString
 }

stop-transcript

The first challenge is getting a list of all Lync servers in the environment. I don’t know of a PowerShell command dedicated to this (Get-CsServers doesn’t exist!).  However, there is a neat little workaround to get this list. The Get-CsManagementStoreReplicationStatus cmdlet lists the replication status of all of the servers in your Lync environment. So this command is used to get the list of servers.

This list is then looped through one at a time and the server name is passed to a .Net command (GetHostAddresses). The result is then written to the screen.

Wrapping all of this into a Transcript allows the output to be easily saved to a text file.

The output of the command is below:

Get-LyncIPs

Leave a Reply

Your email address will not be published.