PowerShell: Out-GridView for displaying data

I often don't feel like typing in long filters in PowerShell for large amounts of data. I have therefore gotten into the habit of filtering the data afterwards. The PowerShell CMDLet "Out-GridView" makes this procedure much easier.

With "Out-GridView", data can be displayed in table form and sorted in different ways. This function is particularly helpful if you want to get a quick overview.

For example, you can get a quick overview of the Exchange mailbox sizes.

Get-Mailbox | Get-MailboxStatistics | select displayname,*size* | Out-GridView

Click on the "TotalItemSize" column to sort the table according to the largest mailboxes:

SNAGHTMLca6f3e

If you then want to quickly sort the table by "Deleted items", just click on "TotalDeletedItemSize". This eliminates the need to enter a new command in PowerShell.

Even the display of large amounts of data with many columns is no problem, as the order of the columns can be subsequently adjusted. Columns can also be hidden at a later date.

For example, the following command provides fairly detailed data on the mailbox statistics:

Get-Mailbox -resultsize unlimited | Get-MailboxStatistics | select * | Out-GridView

image

By sorting and hiding columns, this data can also be displayed clearly again:

SNAGHTML4a3512

This data can then be further restricted using filters:

image

This also works wonderfully for the message tracking logs. This means that you no longer have to enter long commands, but can simply create the data later.

For example, the following command returns all mails from the last 24 hours:

Get-MessageTrackingLog -start (get-date).adddays(-1) | select * | Out-GridView

SNAGHTMLcf8d0e

However, this flood of data can be easily displayed by hiding columns and criteria:

Out-GridView

CSV files can also be viewed quickly in this way. The Message Tracking GUI also uses "Out-Gridview" to display the data. Also very practical in conjunction with "get-aduser".

Maybe it will help someone...

A little tip: I would not necessarily display all message tracking logs from the last 5 years, or the 5 GB CSV file, with "Out-GridView". Filtering is required here.

3 thoughts on “PowerShell: Out-GridView für die Darstellung von Daten”

  1. Moin,
    ja, GridView ist Klasse. Besonders cool ist der -passthru Modus. Aber zwei Dinge nerven doch gewaltig:
    1. Die erste Zeile ist bei der Anzeige immer ausgewählt.
    2. Es ist offenbar nicht feststellbar (wer weiß, wie es geht, möge mir bitte bescheid sagen), ob man „Cancel“ geklickt, oder alle Zeilen abgewählt und „OK“ geklickt hat. In beiden Fällen kommt kein Objekt und nicht etwa eine leere Collection des ursprünglichen Typs zurück.

    Reply

Leave a Comment