MailUser with size and lastname firstname
Hello
I needy to get mailbox users by size that also displays by Lastname & FirsName
I found this command on this website that shows mailuser by lastname, fistname:
get-mailbox -resultsize unlimited | get-user | select
firstname,lastname
I also have this command that shows my size but when I pipe them they don't work togather:
get-MailboxStatistics
| where-object {“IssueWarning”,”ProhibitSend”,”MailboxDisabled”,”NoChecking” -contains $_.StorageLimitStatus} | sort-object StorageLimitStatus, TotalItemSize | Format-Table DisplayName,
StorageLimitStatus, @{expression={$_.TotalItemSize.Value.ToMB()};label=”TotalItemSize(MB)”}
appreciate any help. thanks
August 22nd, 2010 5:18pm
Try this one...it will sort by mailbox size:
Get-MailboxStatistics | Sort-Object TotalItemSize –Descending | ft DisplayName,TotalItemSizeTim Harrington - Catapult Systems - http://HowDoUC.blogspot.com
Free Windows Admin Tool Kit Click here and download it now
August 22nd, 2010 5:33pm
I am going to try it now and reply back. thanks
August 22nd, 2010 5:38pm
it does not display ny lastname, firstname.
I ran the command, and import to csv. It shows DispalyName, itemsize:
DisplayName
TotalItemSize
-----------
-------------
Milstead, Sharon
2001106601B
Greg Lutes
1917200766B
I need to show
Lastname - Firstname - totalitemsize
thanks
Free Windows Admin Tool Kit Click here and download it now
August 22nd, 2010 5:55pm
So instead display name, use firstname and lastname.
Get-MailboxStatistics | Sort-Object TotalItemSize –Descending | ft LastName, FirstName,TotalItemSize
Change the Sort-Object to LastName if you want that instead of TotalItemSize.Tim Harrington - Catapult Systems - http://HowDoUC.blogspot.com
August 22nd, 2010 5:58pm
still does not work. now the names are blank:
LastName FirstName
TotalItemSize
-------- ---------
-------------
2001106601B
1917200766B
1882731741B
I searched google last night and did above for some reason first name, last name come blank!!
Free Windows Admin Tool Kit Click here and download it now
August 22nd, 2010 6:12pm
I dont think Get-MailboxStatistics returns First or last Name, only the DisplayName
Substitute Displayname for those fields in your query or change it to grab those values piped from another command.
August 22nd, 2010 6:21pm
Thanks for reply Andy. We did substitude the displayName and cannot figure out what the new command should look like.
Would you type in the new command, please? thanks
Free Windows Admin Tool Kit Click here and download it now
August 22nd, 2010 6:38pm
On Sun, 22 Aug 2010 15:38:57 +0000, NaserLee wrote:
>
>
>Thanks for reply Andy. We did substitude the displayName and cannot figure out what the new command should look like.
>
>Would you type in the new command, please? thanks
Get-MailboxStatistics | ft displayname,totalitemsize
---
Rich Matheisen
MCSE+I, Exchange MVP
--- Rich Matheisen MCSE+I, Exchange MVP
August 22nd, 2010 7:20pm
Not tested:
$stats = @()
foreach ($mbx in get-mailboxstatistics){
$mbx | add-member -membertype noteproperty -name "LastName" -value (get-user $mbx.displayname).lastname
$mbx | add-member -membertype noteproperty -name "FirstName" -value (get-user $mbx.displayname).firstname
$stats += $mbx
}
$stats | sort totalitemsize -descending |
Format-Table LastName,FirstName, StorageLimitStatus, @{expression={$_.TotalItemSize.Value.ToMB()};label=”TotalItemSize(MB)”}
[string](0..33|%{[char][int](46+("686552495351636652556262185355647068516270555358646562655775 0645570").substring(($_*2),2))})-replace " "
Free Windows Admin Tool Kit Click here and download it now
August 22nd, 2010 7:48pm
Sorry, this still show blank for last names. The first part of script gave error and only displayed First names.
August 22nd, 2010 8:28pm
I am not where I can test. If I could know what errors are displayed, I might be able to help diagnose.[string](0..33|%{[char][int](46+("686552495351636652556262185355647068516270555358646562655775 0645570").substring(($_*2),2))})-replace " "
Free Windows Admin Tool Kit Click here and download it now
August 22nd, 2010 8:33pm
I coudn't copy the error. the printscreen did not work either.
the scrip only produced:
LastName FirstName
StorageLimitStatus TotalItemSize(MB)
-------- ---------
------------------ -----------------
BelowLimit 0
BelowLimit 0
Naser
BelowLimit 0
BelowLimit 0
test5
BelowLimit 0
Test1
BelowLimit 0
BelowLimit
what kind of script (language) is this? I am only familiar with windows shell. I was hoping this can be done in a simplier script that I understand.
I am trying to migrate users from 2007 to exchange 2010 by users last name so I need to get te size also so I would know how many databases based on last name alphab to creat. hope this help.
I will need to logoff now, but I will check back later this afternoon. thanks
August 22nd, 2010 9:00pm
This is Windows Powershell script. All Exchange 2007/2010 EMS shells use the Powershell scripting environment. [string](0..33|%{[char][int](46+("686552495351636652556262185355647068516270555358646562655775 0645570").substring(($_*2),2))})-replace " "
Free Windows Admin Tool Kit Click here and download it now
August 22nd, 2010 9:24pm
Hiya,
As you can see there's lots of different ways to do this.
This is how I'd do it, FWIW. Tested on Exchange 2007 and 2010 SP1 (don't have RTM, sorry) and works fine. I've added the UserPrincipalName as well, as I feel it's useful.
Ex 2007, w/ PS2
Get-Mailbox -ResultSize Unlimited | Get-MailboxStatistics | Select-Object @{Name="UserPrincipalName"; Expression={(Get-User $_.Identity.MailboxExchangeLegacyDn).UserPrincipalName}},@{Name="FirstName"; Expression={(Get-User $_.Identity.MailboxExchangeLegacyDn).FirstName}},@{Name="LastName";
Expression={(Get-User $_.Identity.MailboxExchangeLegacyDn).LastName}}, @{Name="TotalItemSize" ; Expression={$_.TotalItemSize.Value.ToMB()}} | Sort-Object -Property TotalItemSize -Descending
Ex 2010 (well, SP1) which doesn't appear to return a nice TotalItemSize object, hence stripping the bytes value:
Get-Mailbox -ResultSize Unlimited | Get-MailboxStatistics | Select-Object @{Name="UserPrincipalName"; Expression={(Get-User $_.Identity).UserPrincipalName}},@{Name="FirstName"; Expression={(Get-User $_.Identity).FirstName}},@{Name="LastName";
Expression={(Get-User $_.Identity).LastName}}, @{Name="TotalItemSize" ; Expression={[int]([int]$_.TotalItemSize.Split("(")[1].Split(" ")[0].Replace(",","") / 1024 / 1024)}} | Sort-Object -Property TotalItemSize
-Descending
Steve
Steve Goodman
Check out my Blog for more Exchange info or find me on
Twitter
August 23rd, 2010 2:59am
Thanks Steve. It is working fine on one of the two mailbox servers I have.
we have exch 2007 sp. I added server name to the command. the smaller mb server (400 MB) command worked very fast.
on second server (2000 MB) still rumming after 30 min!! wait it just finished ok with data. it could not produce data for 9 users because these users never logged on (service accounts).
I am very havppy with result. Thank you all so much for the effort and replies.
Free Windows Admin Tool Kit Click here and download it now
August 23rd, 2010 5:07am