RE: PS count number of false items

2011-07-18 Thread Mike Hansford
Hi Jeff

To find out what is returned in $returnCheck, could you try:
write-host $returnCheck.GetType()

Comment out the rest of the script or type in each line into the console. If 
$returnCheck returns a collection, then what is in one element of the 
collection?

eg.
write-host $returnCheck[0].GetType()
write-host $returnCheck[0] | Get-member

Another thought: Does
get-help Check_User_In_Active_Directory
give you anything useful?


From: ozmoss-boun...@ozmoss.com [mailto:ozmoss-boun...@ozmoss.com] On Behalf Of 
Paul Noone
Sent: Wednesday, 13 July 2011 2:25 PM
To: jefferyt...@gmail.com; ozMOSS
Subject: RE: PS count number of false items

Hi Jeff,

Beats me. It seems to be an internal command but I can't find any doco for it.

>From what I can tell it returns a user table where [1] represents the Enabled 
>flag.

$returncheck = Check_User_In_ActiveDirectory $Tablename[1] $mydomaincnx

From: ozmoss-boun...@ozmoss.com [mailto:ozmoss-boun...@ozmoss.com] On Behalf Of 
Jeffery Tsui
Sent: Wednesday, 13 July 2011 2:09 PM
To: ozMOSS
Subject: Re: PS count number of false items

what is returned from Check_User_In_ActiveDirectory? a collection of users or 
collection of true/false result?

"I only want to return Nil once for each collection where the False count = 0." 
<-- which collection is this? siteCollUsers or returncheck ?
On Wed, Jul 13, 2011 at 1:52 PM, Paul Noone 
mailto:paul.no...@ceosyd.catholic.edu.au>> 
wrote:
Thanks Geoff. Unfortunately that gives the same incorrect output.

e.g.

domain\User1
domain\User76
Nil
Nil
Domain\User243

I only want to return Nil once for each collection where the False count = 0.

I made some changes and this is getting very close...but still doesn't output 
Nil for empty sets.

I think this may be less of a PS problem and more of a me problem. :)

$returncheck = Check_User_In_ActiveDirectory $Tablename[1] $mydomaincnx
$falseCheck = $returncheck.Count


if($falseCheck -gt 0)
{
foreach($Check in $falseCheck)
{
Write-Output $MyUser.LoginName
}
$falseCheck = 0
}
if($falseCheck -eq 0)
{
Write-Output "Nil"
}
}

From: ozmoss-boun...@ozmoss.com<mailto:ozmoss-boun...@ozmoss.com> 
[mailto:ozmoss-boun...@ozmoss.com<mailto:ozmoss-boun...@ozmoss.com>] On Behalf 
Of Jeffery Tsui
Sent: Wednesday, 13 July 2011 12:56 PM
To: ozMOSS
Subject: Re: PS count number of false items

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 
mailto:paul.no...@ceosyd.catholic.edu.au>> 
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. :)
$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
ozmoss@ozmoss.com<mailto:ozmoss@ozmoss.com>
http://prdlxvm0001.codify.net/mailman/listinfo/ozmoss


___
ozmoss mailing list
ozmoss@ozmoss.com<mailto:ozmoss@ozmoss.com>
http://prdlxvm0001.codify.net/mailman/listinfo/ozmoss


--
___



Notice from Melbourne Business School Ltd


The information contained in this e-mail is confidential, and is intended for
the named person's use only.  It may contain proprietary or legally privileged
information. If you have received this email in error, pleas

RE: PS count number of false items

2011-07-12 Thread Paul Noone
Hi Jeff,

Beats me. It seems to be an internal command but I can't find any doco for it.

>From what I can tell it returns a user table where [1] represents the Enabled 
>flag.

$returncheck = Check_User_In_ActiveDirectory $Tablename[1] $mydomaincnx

From: ozmoss-boun...@ozmoss.com [mailto:ozmoss-boun...@ozmoss.com] On Behalf Of 
Jeffery Tsui
Sent: Wednesday, 13 July 2011 2:09 PM
To: ozMOSS
Subject: Re: PS count number of false items

what is returned from Check_User_In_ActiveDirectory? a collection of users or 
collection of true/false result?

"I only want to return Nil once for each collection where the False count = 0." 
<-- which collection is this? siteCollUsers or returncheck ?
On Wed, Jul 13, 2011 at 1:52 PM, Paul Noone 
mailto:paul.no...@ceosyd.catholic.edu.au>> 
wrote:
Thanks Geoff. Unfortunately that gives the same incorrect output.

e.g.

domain\User1
domain\User76
Nil
Nil
Domain\User243

I only want to return Nil once for each collection where the False count = 0.

I made some changes and this is getting very close...but still doesn't output 
Nil for empty sets.

I think this may be less of a PS problem and more of a me problem. :)

$returncheck = Check_User_In_ActiveDirectory $Tablename[1] $mydomaincnx
$falseCheck = $returncheck.Count


if($falseCheck -gt 0)
{
foreach($Check in $falseCheck)
{
Write-Output $MyUser.LoginName
}
$falseCheck = 0
}
if($falseCheck -eq 0)
{
Write-Output "Nil"
}
}

From: ozmoss-boun...@ozmoss.com<mailto:ozmoss-boun...@ozmoss.com> 
[mailto:ozmoss-boun...@ozmoss.com<mailto:ozmoss-boun...@ozmoss.com>] On Behalf 
Of Jeffery Tsui
Sent: Wednesday, 13 July 2011 12:56 PM
To: ozMOSS
Subject: Re: PS count number of false items

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 
mailto:paul.no...@ceosyd.catholic.edu.au>> 
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. :)
$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
ozmoss@ozmoss.com<mailto:ozmoss@ozmoss.com>
http://prdlxvm0001.codify.net/mailman/listinfo/ozmoss


___
ozmoss mailing list
ozmoss@ozmoss.com<mailto:ozmoss@ozmoss.com>
http://prdlxvm0001.codify.net/mailman/listinfo/ozmoss

___
ozmoss mailing list
ozmoss@ozmoss.com
http://prdlxvm0001.codify.net/mailman/listinfo/ozmoss


Re: PS count number of false items

2011-07-12 Thread Jeffery Tsui
what is returned from Check_User_In_ActiveDirectory? a collection of users
or collection of true/false result?

"I only want to return Nil once for each collection where the False count =
0." <-- which collection is this? siteCollUsers or returncheck ?

On Wed, Jul 13, 2011 at 1:52 PM, Paul Noone <
paul.no...@ceosyd.catholic.edu.au> wrote:

> Thanks Geoff. Unfortunately that gives the same incorrect output.
>
> ** **
>
> e.g.
>
> ** **
>
> domain\User1
>
> domain\User76
>
> Nil
>
> Nil
>
> Domain\User243
>
> ** **
>
> I only want to return Nil once for each collection where the False count =
> 0.
>
> ** **
>
> I made some changes and this is getting very close…but still doesn’t output
> Nil for empty sets.
>
> ** **
>
> I think this may be less of a PS problem and more of a me problem. J
>
> ** **
>
> $returncheck = Check_User_In_ActiveDirectory $Tablename[1] $mydomaincnx***
> *
>
> $falseCheck = $returncheck.Count
>
>
>
> 
>
> if($falseCheck -gt 0)
>
> {
>
> foreach($Check in $falseCheck)
>
> {
>
> Write-Output $MyUser.LoginName
>
> }
>
> $falseCheck = 0
>
> }
>
> if($falseCheck -eq 0)
>
> {
>
> Write-Output "Nil"****
>
> }****
>
> }
>
> 
>
> ** **
>
> *From:* ozmoss-boun...@ozmoss.com [mailto:ozmoss-boun...@ozmoss.com] *On
> Behalf Of *Jeffery Tsui
> *Sent:* Wednesday, 13 July 2011 12:56 PM
> *To:* ozMOSS
> *Subject:* Re: PS count number of false items
>
> ** **
>
> 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 <
> paul.no...@ceosyd.catholic.edu.au> 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
> ozmoss@ozmoss.com
> http://prdlxvm0001.codify.net/mailman/listinfo/ozmoss
>
> ** **
>
> ___
> ozmoss mailing list
> ozmoss@ozmoss.com
> http://prdlxvm0001.codify.net/mailman/listinfo/ozmoss
>
>
___
ozmoss mailing list
ozmoss@ozmoss.com
http://prdlxvm0001.codify.net/mailman/listinfo/ozmoss


RE: PS count number of false items

2011-07-12 Thread Paul Noone
Thanks Geoff. Unfortunately that gives the same incorrect output.

e.g.

domain\User1
domain\User76
Nil
Nil
Domain\User243

I only want to return Nil once for each collection where the False count = 0.

I made some changes and this is getting very close...but still doesn't output 
Nil for empty sets.

I think this may be less of a PS problem and more of a me problem. :)

$returncheck = Check_User_In_ActiveDirectory $Tablename[1] $mydomaincnx
$falseCheck = $returncheck.Count


if($falseCheck -gt 0)
{
foreach($Check in $falseCheck)
{
Write-Output $MyUser.LoginName
}
$falseCheck = 0
}
if($falseCheck -eq 0)
{
Write-Output "Nil"
}
}

From: ozmoss-boun...@ozmoss.com [mailto:ozmoss-boun...@ozmoss.com] On Behalf Of 
Jeffery Tsui
Sent: Wednesday, 13 July 2011 12:56 PM
To: ozMOSS
Subject: Re: PS count number of false items

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 
mailto:paul.no...@ceosyd.catholic.edu.au>> 
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. :)
$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
ozmoss@ozmoss.com<mailto:ozmoss@ozmoss.com>
http://prdlxvm0001.codify.net/mailman/listinfo/ozmoss

___
ozmoss mailing list
ozmoss@ozmoss.com
http://prdlxvm0001.codify.net/mailman/listinfo/ozmoss


Re: PS count number of false items

2011-07-12 Thread Jeffery Tsui
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 <
paul.no...@ceosyd.catholic.edu.au> 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
> ozmoss@ozmoss.com
> http://prdlxvm0001.codify.net/mailman/listinfo/ozmoss
>
>
___
ozmoss mailing list
ozmoss@ozmoss.com
http://prdlxvm0001.codify.net/mailman/listinfo/ozmoss


PS count number of false items

2011-07-12 Thread Paul Noone
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. :)
$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
ozmoss@ozmoss.com
http://prdlxvm0001.codify.net/mailman/listinfo/ozmoss