![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
|
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.
br> br> |
| |||||||
![]() |
| | Thread Tools | Display Modes |
| | #1 (permalink) |
| 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 Specs![]() |
| | #2 (permalink) |
| 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 Specs![]() |
![]() |
| 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 |