66 lines
1.2 KiB
PowerShell
66 lines
1.2 KiB
PowerShell
param(
|
|
[Parameter(Mandatory=$true)]
|
|
[string]$url
|
|
)
|
|
|
|
function Write-Log($msg)
|
|
{
|
|
Write-Host $msg -foregroundcolor green
|
|
($msg) | Out-File "log.txt" -Append
|
|
}
|
|
|
|
function Write-Log1($msg)
|
|
{
|
|
#Write-Host $msg -foregroundcolor green
|
|
($msg) | Out-File "condos.txt" -Append
|
|
}
|
|
|
|
function Get-Group($site, $groupName)
|
|
{
|
|
foreach ($group in $site.RootWeb.SiteGroups)
|
|
{
|
|
if ($group.Name -eq $groupName)
|
|
{
|
|
return $group
|
|
}
|
|
}
|
|
return $null
|
|
}
|
|
|
|
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)
|
|
|
|
$groupName = $web.Title + " - Responsible property managers"
|
|
$group = Get-Group $site $groupName
|
|
if ($group -eq $null)
|
|
{
|
|
Write-Log (" WARNING: group not found")
|
|
continue
|
|
}
|
|
|
|
Write-Log (" Responsible PMs count: " + $group.Users.Count)
|
|
|
|
if ($group.Users.Count -gt 1)
|
|
{
|
|
Write-Log1 ($web.Url + " (" + $group.Users.Count + ")")
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
$wa = Get-SPWebApplication $url
|
|
foreach ($site in $wa.Sites)
|
|
{
|
|
Check-Pmc $site
|
|
}
|
|
#$site = Get-SPSite $url
|
|
#Check-Pmc $site |