Get-FarmHostHeaders.ps1

To reconfigure our load balancing setup, we needed to have a list of all urls used 
in the farm. Since by using the SPSite's property 'url' didn't give use the 
hostheaders of the web application extends, I got them from the IISSettings property 
of the web application, which, according to MSDN, "Gets a collection of settings for 
all Internet Information Services (IIS) instances that belong to the Web application."

(http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.administration.spwebapplication.iissettings.aspx )

[System.Reflection.Assembly]::Load("Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c") | out-null 
[Microsoft.SharePoint.Administration.SPWebService]::ContentService.WebApplications` 
| ForEach-Object{ $_.IisSettings } ` 
| ForEach-Object{ $_.values} ` 
| ForEach-Object{ $_.ServerBindings } ` 
| select HostHeader, Port
Advertisements

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