Hello,
I had a client misplace the URL for a project site today. Once the reference to the site is removed from the project and you don’t know the URL you will need to know what sites are created within the Project Web App site collection. The PowerShell script below will list all sites once you enter the appropriate URL.
-Dan
[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint") > $null
$siteUrl = Read-Host "Enter Site URL"
$rootSite = New-Object Microsoft.SharePoint.SPSite($siteUrl)
$spWebApp = $rootSite.WebApplication
$count = 0
write-host "Site Collections"
write-host ""
foreach ($site in $spWebApp.Sites) {
$count++
write-host "Site Collections URL --> -->" $site.URL
write-host ""
write-host "SubSites"
write-host ""
foreach ($web in $site.AllWebs) {
$count++
write-host "SubSite URL --> --> -->" $web.URL
write-host ""
}
}
write-host "Total Count :" $count