Another chapter in renaming everything in SharePoint…
If you’re looking for a good overview of what an alternate access mapping is, check out Edwin’s article on configuring alternate access mappings.
When you start creating an alternate access mapping, the collection takes the name of the web application. However, this may not be what you want – the context when working with web applications is different than the AAMs. In addition, once the AAM is created, if you rename the web application the name of the AAM isn’t changed.
The name is actually the name of the AAM collection. When you look at the alternate access mappings, each URL is a mapping; the mappings for a web application are a collection, and that’s where the name in the selector comes from, as indicated below.
The AAM collection is a property of the Web Application, so to get a handle on it:
Or, to list web applications and fetch one by ID:
PS C:\Users\Administrator> get-spwebapplication | select displayname, id DisplayName Id ----------- -- SharePoint - 16275 584e9d9c-e652-4b1d-9d77-3ffd033fe14a SharePoint - 80 51ca3304-3629-4fe7-9429-638db13ae225 PS C:\Users\Administrator> $sp=get-spwebapplication -id 51ca3304-3629-4fe7-9429- 638db13ae225 PS C:\Users\Administrator> $sp DisplayName Url ----------- --- SharePoint - 80 http://gemini2010/
Now that you have the web application, the AAM collection is in the property “alternateurls,” which you can hook like this:
$auc = $sp.alternateurls
Now the $auc variable has the alternate access mapping collection, and it’s simple to rename it:
$auc.name="Primary Corporate Website" $auc.update()
If you have a number of SharePoint sites to work with, this is much easier than trying to figure out if the intranet workflow site is “SharePoint – 2580” or “SharePoint – 3740”