Solved

count mailbox via Exchange power shell

Posted on 2013-11-08
4
483 Views
Last Modified: 2013-11-08
hi experts
i want using get-mailbox command to count how many mailbox i have and show the result.
for example get-mailbox -database xxxxx
could you help me complete this command?

thank you
0
Comment
Question by:beardog1113
  • 2
  • 2
4 Comments
 
LVL 68

Expert Comment

by:Qlemo
ID: 39632887
  $noMbx = @(get-mailbox -database xxxx).Count
should do that. @(...) forces the result to be an array, even if only one object is returned. For an array you can always use the Count property to get the number of objects. Simple, isn't it?

Another way, but less elegant, is:
  $noMbx = (get-mailbox -database xxxx | measure-object).Count
Measure-Object is used to get the number of objects, or the average, sum, max, min of numeric properties, or the line/word count of text stream.
0
 

Author Comment

by:beardog1113
ID: 39632961
hello
while i promote both command, there nothing displayed, how can i check the result?

thank you
0
 
LVL 68

Accepted Solution

by:
Qlemo earned 500 total points
ID: 39632993
The result is in the var $noMbx, so just enter that name after executing one of above lines. or remove the leading part including the equal sign.
0
 

Author Closing Comment

by:beardog1113
ID: 39632995
cool
thanks
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

Lotus Notes – formerly IBM Notes – is an email client application, while IBM Domino (earlier Lotus Domino) is an email server. The client possesses a set of features that are even more advanced as compared to that of Outlook. Likewise, IBM Domino is…
Microsoft Office Picture Manager was included in Office 2003, 2007, and 2010, but not in Office 2013. Users had hopes that it would be in Office 2016/Office 365, but it is not. Fortunately, the same zero-cost technique that works to install it with …
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…
This Experts Exchange video Micro Tutorial shows how to tell Microsoft Office that a word is NOT spelled correctly. Microsoft Office has a built-in, main dictionary that is shared by Office apps, including Excel, Outlook, PowerPoint, and Word. When …

911 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now