AXISHK
asked on
Powershell for Exchange 2007
Get-wmiobject -class Exchange_Mailbox -Namespace ROOT\MicrosoftExchangev2 -ComputerName SERVER1 | select-object MailboxDisplayName,TotalIt ems,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
-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"
Tkx
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
DisplayName instead of MailboxDisplayName
Me trying to work on it in my lab to try and see if i can get the data
- Rancy
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Try the following:
Get-wmiobject -class Exchange_Mailbox -Namespace ROOT\MicrosoftExchangev2 -Computer SERVER1 | select-object MailboxDisplayName,TotalIt ems,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.
Get-wmiobject -class Exchange_Mailbox -Namespace ROOT\MicrosoftExchangev2 -Computer SERVER1 | select-object MailboxDisplayName,TotalIt
-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"
ASKER
TotalItems and Size return with blank value. I run on my Exchange mailbox role. Any idea ?
Tkx
Tkx
If using Get-MailboxStatistics command, try replacing TotalItemSize (in select-object section) with this:
@{label=”TotalItemSize(MB) ”;e={$_.To talItemSiz e.Value.To MB()}}
@{label=”TotalItemSize(MB)
ASKER
Still no hope...
[PS] C:\Documents and Settings\adm_sl>Get-Mailbo x | Get-MailboxStatistics |
select-object MailboxDisplayName,@{label ="TotalIte mSize(MB)" ;e={$_.Tot alItemSize
.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={$_.To talItemSiz e.Value.To MB()}} ,Size | Sort -de
scending "Size" | select-object -first 25 > "E:\25 Largest Mailboxes.csv"
[PS] C:\Documents and Settings\adm_sl>Get-Mailbo
select-object MailboxDisplayName,@{label
.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)
scending "Size" | select-object -first 25 > "E:\25 Largest Mailboxes.csv"
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= {$_.TotalI temSize.Va lue.ToMB() }} |Sort -descending "TotalItemSize(MB)" | select-object -first 25 |ft -auto >
"E:\25 Largest Mailboxes.csv"
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=
"E:\25 Largest Mailboxes.csv"
ASKER
It doesn't return any result with the screen state as below. Any idea ?
[PS] C:\Documents and Settings\adm_sl>Get-Mailbo x | Get-MailboxStatistics |
>> select DisplayName, @{n="TotalItemSize(MB)";e= {$_.TotalI temSize.Va lue.ToMB() }
} |Sort -descending "TotalItemSize(MB)" | select-object -first 25 |ft -auto >
>> "E:\25 Largest Mailboxes.csv"
>>
[PS] C:\Documents and Settings\adm_sl>Get-Mailbo
>> select DisplayName, @{n="TotalItemSize(MB)";e=
} |Sort -descending "TotalItemSize(MB)" | select-object -first 25 |ft -auto >
>> "E:\25 Largest Mailboxes.csv"
>>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
- Racny