How to get Alternate Access Mappings in SharePoint Farm Server using Powershell in 2010,2013,2016,2019?

Hello SharePointers,

Below is the  Powershell script to get the list of Alternate access mappings from SharePoint Farm Server .

Add – PSSnapin “Microsoft.SharePoint.PowerShell”

function Get – Alternate – Access – URLs() {

Add – Content $FilePath “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 $FilePath $settings
}
}
Catch {
Write – Host $Error – ForegroundColor Red
}
}
Clear – Host $settingsFilePath = “C:\Prashant\PowerShell\SharePoint Migration\PowerShell – Get-Alternate-Access-URLs\Alternate-Access-Urls.csv”
Get – Alternate – Access – URLs

Happy SharePointing Folks 🙂

Leave a Reply

Your email address will not be published.