36 lines
940 B
PowerShell
36 lines
940 B
PowerShell
param(
|
|
[Parameter(Mandatory=$true)]
|
|
[string]$url
|
|
)
|
|
|
|
function Write-Log($msg) {
|
|
Write-Host $msg -foregroundcolor green
|
|
($msg) | Out-File "log-list-filenotfound.txt" -Append
|
|
}
|
|
|
|
function List-FileNotFound($site) {
|
|
$pagesUrl = "Sivut"
|
|
if ($site.RootWeb.Language -eq 1033) {
|
|
$pagesUrl = "Pages"
|
|
}
|
|
if ($site.ID -eq $site.WebApplication.Sites[0].ID -or $site.Url -eq "http://intra.jarjestotalo.fi") {
|
|
$expectedUrl = "/" + $pagesUrl + "/PageNotFoundError.aspx"
|
|
} else {
|
|
$expectedUrl = $site.ServerRelativeUrl + "/" + $pagesUrl + "/PageNotFoundError.aspx"
|
|
}
|
|
|
|
#Write-Log ($expectedUrl)
|
|
|
|
if ($site.FileNotFoundUrl -ne $null -and $site.FileNotFoundUrl.ToLower() -eq $expectedUrl.ToLower()) {
|
|
return
|
|
}
|
|
Write-Log ($_.Url + "`t" + $_.FileNotFoundUrl + "`t" + $expectedUrl)
|
|
}
|
|
|
|
$webApp = Get-SPWebApplication $url
|
|
$webApp.Sites | ForEach-Object { List-FileNotFound $_ }
|
|
|
|
|
|
#$site = Get-SPSite $url
|
|
#Add-Form-Filling $site
|