How to Script Location Information Service (LIS) database

Here’s a script that will quickly populate your LIS database.

Copy the below into a file and name it something.ps1 (i named mine lis.ps1)

_________________________________________________________________________________________________

##This script will allow you to populate your LIS database quickly based upon subnets. You will need to create a CSV file with the following in the first row of each column
##Subnet, description, location, company, number, street, streetsuffix, city, state, postalcode, country

##asks for a CSV file with the required information
param( [string] $importfile = $(Read-Host -prompt `
“Please enter a file name”))

$locations = Import-CSV $importfile

foreach ($location in $locations)
{

Set-CsLisSubnet -subnet $location.subnet -Description $location.description -location $location.location -CompanyName $location.company -HouseNumber $location.number -StreetName $location.street `
-StreetSuffix $location.streetsuffix -city $location.city -State $location.state -PostalCode $location.postalcode -Country $location.country -Verbose

}

_________________________________________________________________________________________________

Create a csv file with the required headers.  Example:

Capture

Add all relevant information that you need.  Example, my addresses do not need a street “housenumbersuffix”.  For a complete list of options please see http://technet.microsoft.com/en-us/library/gg399016.aspx

Save the file to a location.  Run lis.ps1 and it will ask you for the csv file.  Provide the command a location for where you saved the csv file and hit enter.  It will then loop through all the subnets you have in the CSV file and update them all.  Key word here is UPDATE.  Lets say you have an existing 10.10.10.128 already in LIS, when you run set-cslissubnet, because you have a 10.10.10.128 in your CSV file, it will overwrite the information already stored in LIS.

 

After running the script…don’t forget to run publish-cslisconfiguration.  If you don’t none of the new data will be merged with the CMS and thus replicated around.

4 thoughts on “How to Script Location Information Service (LIS) database

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