Solved

count mailbox via Exchange power shell

Posted on 2013-11-08
4
484 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 69

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 69

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

NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

Question has a verified solution.

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

Learn to move / copy / export exchange contacts to iPhone without using any software. Also see the issues in configuration of exchange with iPhone to migrate contacts.
MS Outlook is a world-class email client application that is mainly used for e-communication globally.  In this article, we will discuss the basic idea about MS Outlook, its advanced features, and types of MS Outlook File formats.
Office 365 is currently available in five editions. Three of them are for business use: Office 365 Business Essentials, Office 365 Business, and Office 365 Business Premium. Two of them are for home/personal use: Office 365 Home and Office 365 Perso…
This Experts Exchange lesson shows how to use VBA to loop through rows in Excel.  In order to sort, filter, and use database features, there needs to be a value in each column for every row. When data arrives with values missing, code to copy values…

773 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