param( [Parameter(Mandatory=$true)] [string]$url ) function Write-Log($msg) { Write-Host $msg -foregroundcolor green ($msg) | Out-File "log.txt" -Append } function Check-Pmc($site) { Write-Log $site.Url foreach ($web in $site.RootWeb.Webs) { if ($web.Url.ToLower().Contains("epostitus") -or $web.Url.ToLower().Contains("lomakkeet") -or $web.Url.ToLower().Contains("akatemia")) { continue } Write-Log (" " + $web.Url) } } $site = Get-SPSite $url Check-Pmc $site