[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Powershell for Exchange 2007

Posted on 2012-08-29
10
Medium Priority
?
740 Views
Last Modified: 2012-08-29
Get-wmiobject -class Exchange_Mailbox -Namespace ROOT\MicrosoftExchangev2 -ComputerName SERVER1 | select-object MailboxDisplayName,TotalItems,Size | sort
-descending “Size” | select-object -first 25 | ConvertTo-html -title
“Top 25 Largest Mailboxes on SERVER1” > “D:\Stats\25 Largest Mailboxes.html”


I want to run a powershell to list out the top 25 mailboxes but it fails. What;s the Namespace should I use ? Is "ROOT\MicrosoftExcahngev2" is the same for every server ?

Tkx
0
Comment
Question by:AXISHK
  • 3
  • 3
  • 3
  • +1
10 Comments
 
LVL 52

Expert Comment

by:Manpreet SIngh Khatra
ID: 38344871
Get-Mailbox | Get-MailboxStatistics | select-object MailboxDisplayName,TotalItems,Size | Sort -descending “Size” | select-object -first 25 > “D:\Stats\25 Largest Mailboxes.csv"

- Racny
0
 
LVL 52

Expert Comment

by:Manpreet SIngh Khatra
ID: 38344889
TotalItemSize its one word :)
DisplayName instead of MailboxDisplayName

Me trying to work on it in my lab to try and see if i can get the data

- Rancy
0
 
LVL 52

Assisted Solution

by:Manpreet SIngh Khatra
Manpreet SIngh Khatra earned 800 total points
ID: 38344916
I ran this command and got the details

Get-Mailbox -Database "DatabaseName"| Get-MailboxStatistics | select-object DisplayName,TotalItemSize |Sort -Descending "TotalItemSize" | select-object -first 25 > C:\Size.txt

- Rancy
0
Nothing ever in the clear!

This technical paper will help you implement VMware’s VM encryption as well as implement Veeam encryption which together will achieve the nothing ever in the clear goal. If a bad guy steals VMs, backups or traffic they get nothing.

 

Expert Comment

by:DCVATech
ID: 38344936
Try the following:

Get-wmiobject -class Exchange_Mailbox -Namespace ROOT\MicrosoftExchangev2 -Computer  SERVER1 | select-object MailboxDisplayName,TotalItems,Size | sort
-descending “Size” | select-object -first 25 | ConvertTo-html -title
“Top 25 Largest Mailboxes on SERVER1” > “D:\Stats\25 Largest Mailboxes.html”

-Computername=-Computer

This should work. Yes, "ROOT\MicrosoftExcahngev2"  is same for all servers.
0
 

Author Comment

by:AXISHK
ID: 38348322
TotalItems and Size return with blank value. I run on my Exchange mailbox role. Any idea ?

Tkx
0
 
LVL 3

Expert Comment

by:Akulsh
ID: 38348379
If using Get-MailboxStatistics command, try replacing TotalItemSize (in select-object section) with this:

@{label=”TotalItemSize(MB)”;e={$_.TotalItemSize.Value.ToMB()}}
0
 

Author Comment

by:AXISHK
ID: 38348434
Still no hope...

[PS] C:\Documents and Settings\adm_sl>Get-Mailbox | Get-MailboxStatistics |
select-object MailboxDisplayName,@{label="TotalItemSize(MB)";e={$_.TotalItemSize
.Value.ToMB()}} ,Size | Sort -descending "Size" | select-object -first 25 > "E:\
25 Largest Mailboxes.csv"
Select-Object : Illegal key label
At line:1 char:52
+ Get-Mailbox | Get-MailboxStatistics | select-object  <<<< MailboxDisplayName,
@{label="TotalItemSize(MB)";e={$_.TotalItemSize.Value.ToMB()}} ,Size | Sort -de
scending "Size" | select-object -first 25 > "E:\25 Largest Mailboxes.csv"
0
 
LVL 3

Expert Comment

by:Akulsh
ID: 38348483
Don't use MailboxDisplayName. It should be DisplayName, as self-corrected by Rancy.
Also don't use Size.
In the next section, use
 |sort -descending "TotalItemSize(MB)" |

So the new command (with some additional minor changes) becomes:

Get-Mailbox | Get-MailboxStatistics |
select DisplayName, @{n="TotalItemSize(MB)";e={$_.TotalItemSize.Value.ToMB()}} |Sort -descending "TotalItemSize(MB)" | select-object -first 25 |ft -auto >
 "E:\25 Largest Mailboxes.csv"
0
 

Author Comment

by:AXISHK
ID: 38348503
It doesn't return any result with the screen state as below. Any idea ?


[PS] C:\Documents and Settings\adm_sl>Get-Mailbox | Get-MailboxStatistics |
>> select DisplayName, @{n="TotalItemSize(MB)";e={$_.TotalItemSize.Value.ToMB()}
} |Sort -descending "TotalItemSize(MB)" | select-object -first 25 |ft -auto >
>>  "E:\25 Largest Mailboxes.csv"
>>
0
 
LVL 3

Accepted Solution

by:
Akulsh earned 1200 total points
ID: 38348518
I think you have to press Enter a few more times.

Otherwise, type the whole command of my previous post in a notepad, and make sure word-wrap is not selected. Then make sure everything is in one line. After that paste the command in powershell.

You may want to change output file name so there are no spaces and you don't have to use quotation marks.
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The main intent of this article is to make you aware of ‘Exchange fail to mount’ error, its effects, causes, and solution.
Eseutil Hard Recovery is part of exchange tool and ensures Exchange mailbox data recovery when mailbox gets corrupt due to some problem on Exchange server.
To show how to generate a certificate request in Exchange 2013. We show this process by using the Exchange Admin Center. Log into Exchange Admin Center.:  First we need to log into the Exchange Admin Center. Navigate to the Servers >> Certificates…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…
Suggested Courses

831 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question