SHAREPOINT MIGRATION – EXPORT Alternate Access Mapping

This is article is next in the series of articles on “SharePoint Migration & Planning” Strategies. You can reach out to the previous articles in this series using the following links:

  1. SHAREPOINT MIGRATION: PLANNING & GUIDANCE ON SHAREPOINT OBJECTS
  2. SHAREPOINT MIGRATION – EXPORT IIS SETTINGS

In this article we will look for the PowerShell Scripts to export “Alternate Access Mapping (AAMs)” Settings from source SharePoint Farm. This information will be helpful to track all the “AAMs” defined in SharePoint Farm.

In Step 1 we will add the PowerShell Snapin to PowerShell Script as usual

1

In Step 2 we define a function and initiate the export CSV file with Column Headers. For this demo I am exporting a few important properties like “Incoming Url, Zone, Public Url” but you may query all possible properties as you deemed fit

In Step 3 we execute the “Get-SPAlternateURL” cmdlet to query the required properties

In Step 4 we loop through the properties collection for all AAM Mapping and list out the queried properties for each mapping

In Step 5 we add the content of properties for each of the AAM Mapping to the CSV file

2

In Step 6 we will set the settings file path and call the function to export the AAM Mappings

3

Once this script get executed successfully, it will export the AAM Mappings in a CSV File as shown below in Step 7

4

We can see the exported mappings as shown below in Step 8

5

Code Reference:

Add-PSSnapin "Microsoft.SharePoint.PowerShell"Add-PSSnapin "Microsoft.SharePoint.PowerShell"
function Get-Alternate-Access-URLs(){ Try {        if (Test-Path $settingsFilePath)        {            Remove-Item $settingsFilePath        }
        Add-Content $settingsFilePath "Incoming Url, Zone, Public Url"
        $aamSettings = Get-SPAlternateURL | Select IncomingUrl,Zone,PublicUrl
        foreach ($aamSetting in $aamSettings)        {            $incomingUrl = $aamSetting.IncomingUrl            $zone = $aamSetting.Zone            $publicUrl = $aamSetting.PublicUrl
            $settings = "$incomingUrl, $zone, $publicUrl"             Add-content $settingsFilePath $settings        }    }    Catch {         Write-Host $Error -ForegroundColor Yellow }}
Clear-Host
$settingsFilePath = "C:\Prashant\PowerShell\SharePoint Migration\PowerShell - Get-Alternate-Access-URLs\Alternate-Access-Urls.csv"
Get-Alternate-Access-URLs

That is all for this demo.

Hope you find it helpful.

Advertisements