try this

$count = 0
# Enumerate orphans
foreach($Check in $returncheck)
{
if($Check -eq $False)
{
Write-Output $MyUser.LoginName
}
else
{
$count += 1
}
}

if($count -eq 0)
{
Write-Output "Nil"
}


On Wed, Jul 13, 2011 at 12:17 PM, Paul Noone <
[email protected]> wrote:

> Hi all,****
>
> I’m having some logic problems with my PS script.****
>
> I am retrieving an array of users from AD and then checking a Boolean
> condition.****
>
> If the count of *False eq 0* then I want to write “Nil”. How do I get a
> count of the False items in $returncheck??****
>
> Can someone please put me out of my misery. J****
>
> $siteCollUsers = $web.SiteUsers****
>
> ** **
>
> foreach($MyUser in $siteCollUsers)****
>
> {****
>
> if(($MyUser.LoginName.ToLower() -ne "sharepoint\system") -and 
> ($MyUser.LoginName.ToLower()
> -ne "nt authority\authenticated users") -and ($MyUser.LoginName.ToLower()-ne 
> "nt
> authority\local service"))****
>
>                 {****
>
>                                 $UserName = $MyUser.LoginName.ToLower()***
> *
>
>                                 $Tablename = $UserName.split("\")****
>
>                                 $returncheck =
> Check_User_In_ActiveDirectory $Tablename[1] $mydomaincnx****
>
> ** **
>
> # Enumerate orphans****
>
> foreach($Check in $returncheck)****
>
>                 {****
>
>                 if($returncheck -eq $False)****
>
>                 {****
>
>                                 Write-Output $MyUser.LoginName****
>
>                 }****
>
>                 elseif($returncheck.Count($False) -eq 0)****
>
>                 {****
>
>                                 Write-Output "Nil"****
>
>                 }****
>
>                 else****
>
>                 {****
>
>                                 # Do nothing****
>
>                 }****
>
>                                 }            ****
>
> }****
>
> }****
>
> ** **
>
> _______________________________________________
> ozmoss mailing list
> [email protected]
> http://prdlxvm0001.codify.net/mailman/listinfo/ozmoss
>
>
_______________________________________________
ozmoss mailing list
[email protected]
http://prdlxvm0001.codify.net/mailman/listinfo/ozmoss

Reply via email to