Solved

Sorting data in Exchange powershell to extract the largest value

Posted on 2014-01-16
3
306 Views
Last Modified: 2014-01-16
i have the following script to get the DB's in a DAG

Get-MailboxDatabase -identity EXCHdb* -Status | select ServerName,Name,DatabaseSize,AvailableNewMailboxSpace | Sort-Object AvailableNewMailboxSpace

result is sorted by AvailableNewMailboxSpace ....

need to extract the largest value and grab the name of DB

how do i pipe that ?
0
Comment
Question by:ARM2009
3 Comments
 
LVL 8

Expert Comment

by:EEhotline
Comment Utility
Try this:

Get-MailboxDatabase -Status | select ServerName,Name,DatabaseSize,AvailableNewMailboxSpace | Sort -property AvailableNewMailboxSpace -Descending
0
 
LVL 68

Accepted Solution

by:
Qlemo earned 250 total points
Comment Utility
Get-MailboxDatabase -identity EXCHdb* -Status |
  Sort-Object AvailableNewMailboxSpace -Descending |
  Select -First 1 ServerName,Name,DatabaseSize,AvailableNewMailboxSpace

Open in new window

if you want a visible output. If you are only interested in the db name:
$largestDB = Get-MailboxDatabase -identity EXCHdb* -Status |
  Sort-Object AvailableNewMailboxSpace -Descending |
  Select -First 1 -Expand Name

Open in new window

0
 

Author Closing Comment

by:ARM2009
Comment Utility
exactly what i was looking for!!! thanks
0

Featured Post

Don't lose your head updating email signatures!

Do your end users still have the wrong email signature? Do email signature updates bore you or fill you with a sense of dread? You can make this a whole lot easier on yourself by trusting an Exclaimer email signature management solution. Over 50 million users do...so should you!

Join & Write a Comment

Disabling the Directory Sync Service Account in Office 365 will stop directory synchronization from working.
ADCs have gained traction within the last decade, largely due to increased demand for legacy load balancing appliances to handle more advanced application delivery requirements and improve application performance.
In this video we show how to create a Contact 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 Recipients >> Contact ta…
The basic steps you have just learned will be implemented in this video. The basic steps are shown to configure an Exchange DAG in a live working Exchange Server Environment and manage the same (Exchange Server 2010 Software is used in a Windows Ser…

771 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

11 Experts available now in Live!

Get 1:1 Help Now