Solved

Sorting data in Exchange powershell to extract the largest value

Posted on 2014-01-16
3
320 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
[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 Comments
 
LVL 8

Expert Comment

by:EEhotline
ID: 39786346
Try this:

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

Accepted Solution

by:
Qlemo earned 250 total points
ID: 39787177
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
ID: 39787614
exactly what i was looking for!!! thanks
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Did you know that more than 4 billion data records have been recorded as lost or stolen since 2013? It was a staggering number brought to our attention during last week’s ManageEngine webinar, where attendees received a comprehensive look at the ma…
A hard and fast method for reducing Active Directory Administrators members.
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…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

724 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