Solved

Sorting data in Exchange powershell to extract the largest value

Posted on 2014-01-16
3
310 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 68

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

Is Your AD Toolbox Looking More Like a Toybox?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Configurire Storage Pool via Powershell 8 34
RSOP Red "X" 7 26
Outlook Disconnected 5 31
exchange out of office 8 39
This process describes the steps required to Import and Export data from and to .pst files using Exchange 2010. We can use these steps to export data from a user to a .pst file, import data back to the same or a different user, or even import data t…
In this article, I am going to show you how to simulate a multi-site Lab environment on a single Hyper-V host. I use this method successfully in my own lab to simulate three fully routed global AD Sites on a Windows 10 Hyper-V host.
In this video we show how to create an Address List 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 Organization >> Ad…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …

911 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

15 Experts available now in Live!

Get 1:1 Help Now