I have to get the list of sites which are using any of the 3 sharepoint AD groups. Here is function responsible for this:
function Search-Groups ($Web, $FilePath)
{
try
{
foreach($User in $Web.Users)
{
if($User.Name -eq "GLOpRED-SP_LT" -Or $User.Name -eq "GLOpRED-SP_PPDA" -Or $User.Name -eq "GLOpRED-SP_GPM")
{
Write-Output $Web.Url | Out-File $FilePath -append
break
}
else
{
Write-Host "Given groups are not being used in $($Web)"
}
}
}
catch
{
Write-Warning "An errorr occured when trying to access groups: $_"
}
}
The problem is, that it didn't found any sites with those groups, despite that they exist. Anyone has an idea what is wrong with this function?