param( [Parameter(Mandatory=$true)] [string]$url, [Parameter(Mandatory=$false)] [switch]$includeShortName ) function Write-File($msg) { ($msg) | Out-File "log-condos.txt" -Append } function Write-Info($msg) { Write-Host $msg -foregroundcolor green Write-File $msg } function Write-Warn($msg) { Write-Host $msg -foregroundcolor yellow Write-File $msg } $site = Get-SPSite $url foreach ($web in $site.RootWeb.Webs) { if (-not $includeShortName) { #Write-Info ('"' + $web.Title + '" "' + $web.Url.Substring($web.Url.LastIndexOf("/") + 1) + '"') Write-Info ($web.Title + ';' + $web.Url.Substring($web.Url.LastIndexOf("/") + 1)) } else { #Write-Info ('"' + $web.Title + '" "' + $web.AllProperties["CondoShortName"] + '" "' + $web.Url.Substring($web.Url.LastIndexOf("/") + 1) + '"') Write-Info ($web.Title + ';' + $web.AllProperties["CondoShortName"] + ';' + $web.Url.Substring($web.Url.LastIndexOf("/") + 1)) } }