Lync location Information Services (LIS) automation script
Lync Location Information Services
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 store. 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 that the machine is connecting to, with the subnet information stored and configured in the LIS. Finally, Lync client will display the location information accordingly.
The command that is used to set and map subnets to location is Set-CsLisSubnet
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 location information services with location information, is the ability to maintain sch information, as the physical subnets are changed or new one get introduced. So, let us start with two simple facts:
- Lync location information services or LIS takes C subnet network. So, if you have 10.10.8.0 /22, 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-entered the same subnet with different location information, the old entry will be overwritten.
Saying that, what i usually do is to maintain a sheet with the following fields :
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 location information services.
When I have changes in my subnets and location information, I can run the script again without worrying about duplicate data in my Lync location information services as it 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 which is the csv file to import data from.
The script will also generate an error file that contains which subnet information could not be imported to the Lync location information services, so you can track such errors and maybe fix the input data in your sheet.
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 :
On the other hand, if you want only to fill the Subnet and Description information, the csv file should look like the below.