Lync Information Services (LIS) – Import CSV Subnet Location PowerShell Script

Introduction

Lync Server includes the Location Information service (LIS), which provides location information to clients such as Lync Desktop and Microsoft Lync Phone Edition.

Location information is stored in a dedicated database (LIS) in the Central Management Server. The cool thing about this, is that you can map your physical subnets for example, with an actual location. When Lync client signs in, it will attempt to map the subnet of the machine it is running on, with the subnet information stored and configured in the LIS, and will display the location information accordingly.

The command that is used to set and map subnets to location is Set-CsLisSubnet. Example:

Set-CsLisSubnet -Subnet 10.164.25.0 -Description “Corp” -Location “Redmond” -CompanyName “Contoso Corporation” -HouseNumber “123” -HouseNumberSuffix “” -PreDirectional “” -StreetName “Contoso Way” -StreetSuffix “” -PostDirectional “” -City Redmond -State “WA” -PostalCode 73291  -Country US

This cmdlet will associate the subnet 10.164.25.0 with the physical address Contoso Corporation, 123 Contoso Way, Redmond,  WA, 73291, United States.

Note: After mapping location information to network subnets using the preceding cmdlets, use the cmdlet Publish-CsLisConfiguration.

The script that will simplify everything

The tricky part about populating the Lync subnet with location information is the ability to maintain the information. So let us start with two simple facts:

– LIS will take subnet C network. So if you have 10.10.8.0 /24, then you have to use the Set-CsLisSubnet four times. One for 10.10.8.0 and another three times for 10.10.9.0,10.10.10.0,10.10.11.0.

– If you have already entry for 10.10.10.0 for example and you re enter the Set-CsLisSubnet again with different information, the old entry will be overwritten.

Saying that, what i usually do is to have a sheet with the following fields :

  • Subnet
  • Description
  • Location
  • CompanyName
  • HouseNumber
  • HouseNumberSuffix
    PreDirectional
  • StreetName
  • StreetSuffix
  • PostDirectional
  • City
  • State
  • PostalCode
  • Country

Then i start adding my Class C subnets to the sheet, and populating each subnet with location information. All fields are optional except the Subnet field, as it acts as an identifier.

Once i have my sheet ready, i will use the my Set-CorpCSSubnet.ps1 script to import that csv file to Lync Information services.

Whenever i have to change my CSV file, i can run the Set-CSSubnet.ps1 script again and again without worrying about duplicate data in my Lync Information Services. Lync Information Services will always overwrite old with new information.

The script will take two parameters:

  • Script working directory:  example can be c:\users\john\desktop.  We use this path to generate error file and read the csv file
  • Sheet name : example can be “mysheet.csv”. the script will then try to read “c:\users\desktop\mysheet.csv”

The script will also generate an error file that contains which subnet information could not be imported to Lync Information Services, so you can track the error and maybe fix the input data in your sheet.

Set-CorpCSSubnet PS

 

So start by creating a csv file. The CSV file should have all the fields, but you can only fill the fields that you care about. Say for example you want just to fill the Subnet,Description,CompanyName and Country fields. Then the csv will look like this :

Set-CorpCSSubnet  example 1

 

On the other hand, if you want only to fill the Subnet and Description information, the csv file should look like the below.

Set-CorpCSSubnet example 2

 

Download the Script

You can download the script from here: Set-CorpCSSubnet

 

 

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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