?
Solved

Sorting data in Exchange powershell to extract the largest value

Posted on 2014-01-16
3
Medium Priority
?
325 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 1000 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

This article will help to fix the below errors for MS Exchange Server 2013 I. Certificate error "name on the security certificate is invalid or does not match the name of the site" II. Out of Office not working III. Make Internal URLs and Externa…
In the absence of a fully-fledged GPO Management product like AGPM, the script in this article will provide you with a simple way to watch the domain (or a select OU) for GPOs changes and automatically take backups when policies are added, removed o…
This tutorial will walk an individual through the process of configuring their Windows Server 2012 domain controller to synchronize its time with a trusted, external resource. Use Google, Bing, or other preferred search engine to locate trusted NTP …
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
Suggested Courses
Course of the Month11 days, 7 hours left to enroll

752 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