Reputation: 67
I was able to retrieve all the web application names within a farm using object model. But I could not find a way to display all the web application URLs within a farm.
Can some one help me with this?
Upvotes: 1
Views: 2447
Reputation: 52450
I take it you probably really want all site collection URLs on all web applications. Here's a short powershell script I wrote - you should be able to infer the C# OM from this:
[reflection.assembly]::loadwithpartialname("microsoft.sharepoint") > $null
[Microsoft.SharePoint.Administration.SPFarm]::local.services | `
where-object {$_ -is [Microsoft.SharePoint.Administration.SPWebService] } | `
select -expand webapplications | select -expand sites | `
select url, zone, owner, rootweb | format-table -auto
Hope this helps,
-Oisin
Upvotes: 1