Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

error when running powershell command

Posted on 2014-04-08
6
Medium Priority
?
190 Views
Last Modified: 2014-04-17
i want to get a list of user accounts in exchange with total size and item count. when i put the exchange server's name in the brackets, and i think i have a successful code, i dont get any results. if i put in a bad exchange server, i get the error in red text.

get-mailboxstatistics -server 'exchange' |sort-object totalitemsize -descending | ft displayname,totalitemsize,itemcount
error
0
Comment
Question by:ttrbrtsn
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
6 Comments
 
LVL 71

Accepted Solution

by:
Qlemo earned 2000 total points
ID: 39987338
The command is correct that way. What if you omit the server parameter?
0
 
LVL 17

Expert Comment

by:Premkumar Yogeswaran
ID: 39988087
Make sure the exchange management shell opened without any error.

Try to close and open the shell.

And also give some different mailbox server name.
0
 
LVL 63

Expert Comment

by:Simon Butler (Sembee)
ID: 39988177
Your command isn't really right.
You have mixed up mailboxstatistics with mailboxserver, you also haven't said which mailbox you want the statistics for. Furthermore, if you have one server then you don't need the server address at all.

get-mailbox | Get-MailboxStatistics | sort TotalItemSize -desc |ft DisplayName,TotalItemSize, ItemCount

If you have multiple servers then run

Get-MailboxServer  servername | Get-Mailbox | Get-MailboxStatistics | sort TotalItemSize -desc |ft DisplayName,TotalItemSize, ItemCount

Simon.
0
 
LVL 71

Expert Comment

by:Qlemo
ID: 39988311
Simon,

The syntax without ID and server works for MSX 2007, but not for MSX 2013. The latter needs an identity/mailbox, server or database. So the syntax as originally shown is still valid for MSX 2013, and should result in dumping all mailboxes of that server.


ttrbrtsn,

Maybe we should be clear about the Exchange release used? And did you check whether the Mailbox Server role is active on that machine?
0
 
LVL 71

Expert Comment

by:Qlemo
ID: 40006443
I don't think I deserve the points. Can you explain whether and how my comment really helped?
0

Featured Post

Does Powershell have you tied up in knots?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

Question has a verified solution.

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

There are times when we need to generate a report on the inbox rules, where users have set up forwarding externally in their mailbox. In this article, I will be sharing a script I wrote to generate the report in CSV format.
As much as Microsoft wants to kill off PST file support, just as they tried to do with public folders, there are still times when it is useful or downright necessary to export Exchange mailboxes to PST files. Thankfully, it is still possible to e…
In this Micro Video tutorial you will learn the basics about Database Availability Groups and How to configure one using a live Exchange Server Environment. The video tutorial explains the basics of the Exchange server Database Availability grou…
To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…
Suggested Courses

618 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