Solved

Sorting data in Exchange powershell to extract the largest value

Posted on 2014-01-16
3
315 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
ID: 39786346
Try this:

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

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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

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…
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.
In this video we show how to create a mailbox database 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 >> Data…
This tutorial will walk an individual through the process of transferring the five major, necessary Active Directory Roles, commonly referred to as the FSMO roles from a Windows Server 2008 domain controller to a Windows Server 2012 domain controlle…

777 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