Windows Vista Forums
Vista Forums Home Join Vista Forums Donate Vista Tutorials Tags

Welcome to Vista Forums we are your forum to discuss Windows Vista x64 and x86 systems. Whether you need help or just want to post an idea you have on Vista, this is the forum for you.
Register at Vista forums...the world biggest Windows Vista resource Join Vista Forums Now

Go Back   Vista Forums > Microsoft Technical Newsgroups > PowerShell

foo.count without formatting

Update your Vista Drivers Update Your Drivers Now!!
Closed Thread
 
Thread Tools Display Modes
Old 01-08-2007   #1 (permalink)
Brian Hoort
Guest


 

foo.count without formatting

How can I get foo.count to return just the integer so I can perform
arithmetic on the result?

I'm trying to write a one-liner that will return the number of
non-disabled users in our AD. So far I can do this by invoking a
dsquery returning all users, piping that into a ".count -line", then
doing another with the dsquery switch that only returns disabled
accounts, then getting a ".count -line" on that -- that far I've gotten
(albeit with formatted output). Then I just subtract the disabled
count from the full and get my count -- but I can't do this because the
object .count returns isn't just an int -- it's a big formatted text
object.

Any thoughts?


My System SpecsSystem Spec
Old 01-08-2007   #2 (permalink)
Brandon Shell
Guest


 

Re: foo.count without formatting

Can you post the code?

I tried this and it worked as expected... of course I used a ls instead of
AD object, but should be the same result.

PS C:\> $foo = ls * -recurse
PS C:\> $foo.count
77070
PS C:\> $foo.count + $foo.count
154140
PS C:\> $foo.count + $foo.count - ($foo.Count / 2)
115605
PS C:\>


"Brian Hoort" <brian.hoort@gmail.com> wrote in message
news:1168297135.721425.65500@11g2000cwr.googlegroups.com...
> How can I get foo.count to return just the integer so I can perform
> arithmetic on the result?
>
> I'm trying to write a one-liner that will return the number of
> non-disabled users in our AD. So far I can do this by invoking a
> dsquery returning all users, piping that into a ".count -line", then
> doing another with the dsquery switch that only returns disabled
> accounts, then getting a ".count -line" on that -- that far I've gotten
> (albeit with formatted output). Then I just subtract the disabled
> count from the full and get my count -- but I can't do this because the
> object .count returns isn't just an int -- it's a big formatted text
> object.
>
> Any thoughts?
>



My System SpecsSystem Spec
Closed Thread

Thread Tools
Display Modes



Similar Threads
Thread Thread Starter Forum Replies Last Post
count IT STAFF PowerShell 7 07-16-2008 04:52 AM
Pop ups blocker count Karen Vista security 1 12-31-2007 11:22 AM
Count Thomas PowerShell 3 03-02-2007 01:23 AM
Bug in array.count? Msh newbie PowerShell 5 02-08-2007 05:59 PM


Vistax64.com is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media 2005-2008

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51