header
header Register : : Login header
header
divider
menuleft
menuright
submenu
left

[August 25th, 2008] Check the home page regarding PowerShell related news from a brand new sponsor: Idera

Powershell List Length
Last Post 08 Jul 2008 03:59 PM by KarlMitschke. 3 Replies.
Printer Friendly
Sort:
PrevPrev NextNext
You are not authorized to post a reply.
Author Messages
mdgrayUser is Offline
New Member
New Member
Posts:5

--
08 Jul 2008 08:03 AM  

 

I was trying to determine how I can display the number of lines in a list. For Example the following commands outputs al the ActiveSync users. I would like to email a list and also a summary of the number of users.

Get-CASMailbox | where {$_.HasActiveSyncDevicePartnership} | select DisplayName

Is their a easy way to display the List Length?

 

 

KarlMitschkeUser is Offline
Basic Member
Basic Member
Posts:161

--
08 Jul 2008 02:37 PM  
Something like this should work:

$users = Get-CASMailbox -resultsize unlimited | where {$_.HasActiveSyncDevicePartnership} | select DisplayName
$users

Karl
halr9000User is Offline
Basic Member
Basic Member
Posts:316

--
08 Jul 2008 03:48 PM  
And to get the #, you can access the length property of any collection, or you can pipe to measure-object.

$users.length
$users | measure-object
KarlMitschkeUser is Offline
Basic Member
Basic Member
Posts:161

--
08 Jul 2008 03:59 PM  
Thanks, Hal;

I was looking for measure-object - I knew it, but I forgot i knew it ;)
You are not authorized to post a reply.

Active Forums 4.1
right
   
footer Sponsored by Quest Software • SAPIEN Technologies • ShellTools, LLC • Microsoft Windows Server 2008 footer
footer