SharePoint 2016: How To Implement Alternate Access Mapping

In this article we will discuss implementing “Alternate Access Mapping” or commonly known as “AAM” in SharePoint 2016.

Alternate Access Mapping Architecture

If you are not aware of AAM or you have some misconceptions about it, I would highly recommend you to read through an excellent blog Alternate Access Mappings (AAMs) *Explained by “Brain Pendergrass” from Microsoft and would like to thank him for such an awesome blog to make me understand this concept in depth.

This article will focus on guided steps to configure AAM in SharePoint 2016 and we won’t discuss AAM as a concept.

Create New Web Application

Step 1: To start the demo let go to SharePoint Central Admin Site and click on “Manage Web Applications” as shown below-


I am creating a new Web Application for demo purpose. In real environments we can use any existing Web Application to perform these steps.

Step 2: Click “New” menu to launch “Create New Web Application” wizard


Step 3: Enter Web Application Name and other necessary information


Once done click OK to start the process


When the creation process has been completed then we can see a new Web Application listed in the list of Web Applications


Also we may see the Modal Dialog that offers quick link to create new Site Collection for this Web Application


Create New Site Collection

Step 4: Click on “Create Site Collection” link to create new Site Collection for the Web Application.

Select Web Application


Enter Title, URLs, Template, Primary Site Collection Administrator


Click “OK” to start the process


Once process has been completed we can see new Site Collection created for the Web Application


We can navigate to the site collection by clicking the URL


Add DNS Entries

Step 5:  Now we have configure add host entries to DNS.

Search for DNS


Add new Host Entry to the “Forward Lookup Zone” as shown below-


In New Host screen, enter Host Name, Select FQDN, enter IP Address. Once done click “Add Host”


If operation completed successfully we can see popup window show success message


We can see this new Host added to the existing list


Add/Update IIS Bindings

Step 6: Add “IIS” Bindings

Now we have to add IIS bindings for the new Host. Search for “IIS” and select “Internet Information Services (IIS) Manager”


Select the Web Application that we have created in above steps from the “Connections” Panel on the left under “Sites” node

Click on “Bindings…” on the right to Add/Edit Web Application Bindings


In the “Site Bindings” screen select the default binding and click “Edit”


In the “Edit Site Binding” screen enter Host Name value and this should match the entry that we have created earlier in DNS

Click OK


Once saved the existing binding will look like as shown below-


Configure Alternate Access Mappings Using Central Admin

Step 7: Configure Alternate Access Mappings (From Central Admin)

Go To Central Admin -> “Application Management”

Under Web Applications Click “Configure alternate access mappings”


Click “Edit Public URLs”


In the “Edit Public Zone URLs” Screen and enter “Default Zone” URL with “Host Name” configured earlier as shown below.

Click “Save” once you entered the default Zone URL to save the data.


Now try accessing SharePoint Web Application using Public Zone URL and if the configuration goes well, the access will be granted to you

Test Alternate Access Mappings


Configure Another Mapping

Step 8: Repeat Step 5 to add another DNS entry to add a new Host Name


Step 9: Repeat Step 6 to Add Web Application Bindings


Configure Alternate Access Mappings Using PowerShell

Step 10: Configure Alternate Access Mappings (Using PowerShell)

Now we will add this new Host Name to the default zone for the web application

Launch SharePoint 2016 Management Shell


“New-SPAlternateURL” cmdlet gives us option to add new Alternate URLs to the required zone for web application

This cmdlet take following parameters

  • New Alternate URL – URL that you need to register as alternate URL
  • Web Application Path – URL that represent Web Application
  • Zone – Represents a zone that you need this alternate URL to add to


Once this command executes successfully we can a new Alternate Access Mapping added to the list


Test Alternate Access Mapping

Now if try to access this web application using this new mapping it still be translated to the same Public URL for the Web Application.


By following above steps we can enable a web application that receives the request from an internal URL in one of the five authenticated zones to return pages that contain links to the public URL for the zone

Hope you find it helpful.

SharePoint 2013/2016: How to Find Duplicate Records in SharePoint List

During one of my assignments I have come across a situation where we need to fix data issues in SharePoint Lists.

One of the issues that we found was presence of duplicate data. In order to fix that problem in hand I had developed a Powershell Script to find out duplicate data based on a specific or a group of columns.

For the sake of demo, I have added a SharePoint List with some duplicate records in it as shown below:


Now let’s look into the code to understand implementation details-

In Step 1 we are getting references of the Site and Web where the SharePoint List resides

In Step 2 we are splitting the list of columns based on which we want to find out the duplicate data

We can see there are two input variables “ColumnToValidate” and “ColumnToDisplay”. “ColumnToValidate” provides columns based on which duplicity needs to be checked while “ColumnToDisplay” contains the list of columns that needs to be the part of data export.

In Step 3 we are creating the export folder that will hold the CSV files exported with duplicate records

In Step 4 we are creating the list object that will give the handle on the list which needs to be validated


In Step 5 we are getting list of Items from SharePoint List and grouping them based on the validation columns

In Step 6 we are creating the directory for export files

In Step 7 we are exporting all the groups which is having item count greater than 1 (this logic identifies the duplicate items)


That is all for the code.

Now we will see the variation in outputs depending on the columns specified for duplicacy check

In Step 8 we specify the validation and display columns, for the first execution we will check duplicate values in “Title” column

In Step 9 we are calling the “Get-DuplicateListItems” function to find the duplicate values


After the function executed successfully we can see the following output.

In Step 10 we can see the output of this excution and can see 6 items found which duplicate in Title Column


In Step 11 we can see the CSV file that is exported by the execution considering “Title” Column to be validated.


In Step 12 we can see the output file and can notice duplicate values in “Title” Column


In Step 13 we have changed the list of columns to be validated. In this second execution I have added another column “Role”.

Now the list will be validated for duplicity based on the combination of “Title & Role” Columns


In Step 14 we can see the output of this excution and can see 4 items found which duplicate in “Title & Role” Columns


In Step 15 we can see the CSV file that is exported by the execution considering “Title & Role” Column to be validated


In Step 16 we can see the output file and can notice duplicate values in “Title & Role” Column


In Step 17 we have changed the list of columns to be validated. In this second execution I have added another column “Location”.

Now the list will be validated for duplicity based on the combination of “Title & Role & Location” Columns


In Step 18 we can see the output of this excution and can see 2 items found which duplicate in “Title & Role & Location” Columns


In Step 19 we can see the CSV file that is exported by the execution considering “Title & Role & Location” Column to be validated


In Step 20 we can see the output file and can notice duplicate values in “Title & Role & Location” Column


This is a very simple technique that can be used to fix one of the issues with SharePoint List data.

Hope you find it helpful.

SharePoint 2016/2013 : Event Log Monitoring by PowerShell Automation

This article is based on the requirement I recently encounter where I was required to monitor a specific exception type and if it occurs the Admins should be notified at the same time.

In this demo I am considering a scenario that if ever we have encountered an Event ID “1101” that would mean the SharePoint Site or any related service is down and in that case the Administrators will get Email Notifications automatically.


In order to accomplish this let start with writing a PowerShell function “Monitor-Event-Logs” as shown in Step 1

In Step 2 we are making use of “Get-EventLog” commandlet by instructing it to get the top 1 latest Application Log where the Event ID = “1101”

We can check for Event Object for null and if it returns the data  we prepare the Email Content comprising of relevant data in as shown in Step 3

In Step 4 we are sending Email Notification to the Administrators by using another generic function “Send-Email”


There is an external function “Execute-Process” that will call the “Monitor-Event-Logs” function by passing required Event ID as shown in Step 5

In Step 6 we are initializing the required variables pointing to the email ids of the respective contact persons

Finally in Step 7 we will call the “Execute-Process” function that will drive the whole mechanics.


Once the function gets executed we can see the email arrived notifying the error to the administrators as shown below:


To make this process more intuitive I got this script scheduled using Windows Task Scheduler to run on a specific time intervals and scan the logs for specific Event IDs.

In my actual implementation I design the “Monitor-Event-Logs” function to accept an array of Event IDs to be monitored so you can try it that way depending on your requirements.

Hope you find it helpful.




SharePoint 2016/2013/Online: Sites Health Monitoring by PowerShell Automation

It is not uncommon that we need to perform health monitoring on SharePoint Sites to ensure that we have stable and healthy SharePoint Farms and to ensure maximum possible availability of all the sites.

In this article we will discuss a simple yet powerful automation technique using PowerShell that will try ping the Site and if gets failed it will send the email notifications to the designated SharePoint Admins for the Site.

With this background let’s start with the demo…

In this demo we have two SharePoint Sites in Question as follows-

The On-Premise site is up and running while SharePoint Online Site is down and unavailable due to some technical reasons

In order to automate this monitoring process I have written a simple function in PowerShell as explained below-

Step 1: Create an Object of System.Net.WebClient Class. This object will provide us the methods to deal with Site Pages

Step 2: Make use of DownloadString Method of this class to download the html of the respective Site Page

Step 3: Check for Possible Error Messages that SharePoint Page would generally contains in case of Site is not accessible by making use of Wild Card Search using Contains Method

Step 4 & 5: We are sending emails to the SharePoint Admins Informing that a specific site is down, so that they can take appropriate actions accordingly.


Step 6: This is the initiation function that is having an array of SharePoint Site URLs that requires monitoring.

Step 7: This function will call for Step 1 to Step 5 for each SharePoint Site URL in a periodic manner and keep on circulating the notifications in case of health issues with SharePoint Sites.


Once this automation script executes we can see the following email notification for SharePoint Online Site which is currenly down:


And there will be no emails for SharePoint On-Premise Site since it is healthy and active as shown below:


That is all for this demo.

Hope you find it helpful.

SharePoint 2016/2013 Administration : How to Create Host Header Site Collections

A host-named site collection allows you to address a site collection with a unique DNS name, such as

SharePoint decides the mapping of the Host Name with the Site Collection at the time of initializing SPSite Object. During the initialization Process SharePoint queries the SPWebApplication object to see if Host Header details are associated with the Site Collection and if there is no information returned on Host Headers then it becomes evident that this is a typical site collection.

If we inspect the ULS logs for Site Collections with Host Headers, we will see the entries like Site lookup found the host header site on the other hand if we inspect the same logs for Site Collections without Host Headers Looking up the additional information about the typical site http://serverName:Port/sites/site001

In this article we will look into the steps to create Host Header based Site Collections as per the following process –


Step 1: Add DNS Entry

  • Search for DNS on Windows Server


  • Select the Domain Name
  • Right Click and Select “New Host”


  • Enter new Host Name
  • Enter IP Address of the Hosting Server
  • Click Add Host


This will add a new Host Name entry in the DNS Catalog


 Step 2: Create Site Collection

Since we don’t have Web UI available to create the Host Header based Site Collections so the only option we are left with PowerShell only.

Following is the PowerShell command that we can use to create a Host Header based Site Collection-

New-SPSite “http://developerWorkspace001.PRASHANT.LOCAL” -HostHeaderWebApplication “http://developmentportal.prashant.local:2016” -Name “Developers Workspace 001” -OwnerAlias “Prashant\Administrator” -Template “DEV#0”

In this command we have the following parameters and their values:


Once you execute the PowerShell we can see the following output


We can verify the creation of the new Host Header Site Collection by going to

Central Administrator -> Application Management -> View All Site Collections






Step 3: Add Site Binding

Following is the PowerShell command that we can use to Add the Site Binding in IIS-

New-WebBinding -Name “Development – Portal” -IPAddress “*” -Port 2016 -HostHeader “developerWorkspace001.PRASHANT.LOCAL”

In this command we have the following parameters and their values:


Once the PowerShell executed successfully we can see the following output on the command prompt


We can verify the creation of Site Binding in the IIS by using following steps:

  • Search for IIS on Windows Server


  • Select the Web Application and click on Bindings Links as shown below


  • On the Site Bindings Window we can see a new Site Binding Added to the IIS


  • Select the Site Binding and Click Edit button to open Edit Site Binding window


This shows that Binding is created successfully.

Now lets’ visit the Host Header Site Collection by visiting the following URL:



Enter the credential when asked for



And there we are



That is all for this demo.

Hope you find helpful.

SharePoint 2016/2013 Administration : How to Create Host Header Web Applications

When we deal with Web Application URLs in SharePoint Environment it is quite important to review the URL Structure. By default when we create any SharePoint Web Application, it takes server name as default while preparing the URL structure as follows-

http:// <Server Name>:<Port>

Using Host Header we can overwrite this default behavior of comprising Web Application URL by SharePoint Engine.

In this article we will look for the Steps to create Web Applications with Host Headers.

If we look for the Web Application List created we can see only two Web Applications created as shown in the figure below:


If we closely look for Web Application SharePoint -80 which has been created with defaults and that is why if you see to the URL you will notice the URL structure is http:// <Server Name>:<Port>

Now in order to create the Host Header based Web Applications we need to follow the below steps:


Add DNS Entry for Host Header

  •  Search for DNS on Windows Server


  • Right Click on the Domain Name
  • Choose New Host


  • Specify the Name Host Header
  • Specify IP address to the Server
  • Click Add Host Button



Create Web Application Using PowerShell

As we know that default Authentication Mode for a Web Application is Classic when it is created using PowerShell. But here we have to create a Web Application in Claims Based Authentication Mode and that is why it is necessary to initialize the authentication provider by calling New-SPAuthenticationProvider command which return a fresh object referring Claims Based Authentication

$authenticationProvider = New-SPAuthenticationProvider

Then we need to call for New-SPWebApplication command to create a new Web Application utilizing Host Header as below-

New-SPWebApplication -Name “Development – Portal”  -Port 2016 -HostHeader “developmentportal.PRASHANT.LOCAL”  -URL “http://developmentportal.PRASHANT.LOCAL&#8221;  -ApplicationPool “SharePoint – 2016” -ApplicationPoolAccount (Get-SPManagedAccount “Prashant\Administrator”)  -AuthenticationProvider  $authenticationProvider


Once we get this PowerShell command executed using SharePoint Management Shell successfully, we can see the details of the new Web Application created just now


Similarly we can go back to Central Administration to look for List of Web Applications and can be able to locate this newly created Web Application

It is important to note the URL of the newly created Web Application and see the Host Header is now present in the Web Application URL Structure as needed.


And we are done!!

Hope you find it helpful.

SharePoint 2013 Administration : Enable & Modify Continuous Crawl

SharePoint 2013 includes a new type of crawl by the name Continuous Crawl that ensures the maximum possible refreshness of SharePoint Index.


The Continuous Crawl has got the ability to run in parallel and does not expect any previous crawl to get completed before the current one launched.

The Continuous crawl is available only for the SharePoint Index of type SharePoint Sites.

Once started a Continuous Crawl can be Paused or Stopped or Disabled

The default craw interval for Continuous Crawl is 15 minutes but this can be set to any appropriate value.

Since we don’t have any User Interface in SharePoint 2013 to set this value so we are left with only possibility i.e. by using PowerShell.

Enable Continuous Crawl : Central Administration

  • Go to Central Admin and Click on Manage Service Applications


  • Click on Search Service Application


  • On Search Administration Page click on the Content Sources link on the left navigation


  • Select SharePoint Index that you want to enable with Continuous Crawl


  • On the SharePoint Index Settings Page, scroll down to Crawl Schedule section and select Enable Continuous Crawls radio button and save the settings.


Enable Continuous Crawl : PowerShell

$serviceApp = Get-SPEnterpriseSearchServiceApplication

$contentSource = Get-SPEnterpriseSearchCrawlContentSource -SearchApplication $serviceApp -Identity “Local SharePoint sites”

Set-SPEnterpriseSearchCrawlContentSource -Identity $contentSource -EnableContinuousCrawls $True

Modify Default Interval of Continuous Crawl : PowerShell

$serviceApp = Get-SPEnterpriseSearchServiceApplication

$serviceApp.SetProperty(“ContinuousCrawlInterval”, 5)


Hope you find it helpful.