PowerShell script for sorting data
hello all,
i'm trying modify output of mailbox report run on exchange server, use exchange shell execute ps1 file. view these reports in excel , after report has been produced have make amendments in excel, 1 of following amendments sorting size largest smallest in 1 of columns.
now i'm sure can automated done within ps1 file, rather doing manually. i've done research , following command has come up:
| sort-object -descending
i've little knowledge on powershell don't know stick command. i've done following below has not worked:
$userobj = new-object psobject
$userobj | add-member noteproperty -name "displayname" -value $mb.displayname
$userobj | add-member noteproperty -name "last mailbox logon" -value $lastlogon
$userobj | add-member noteproperty -name "last logon by" -value $stats.lastloggedonuseraccount
$userobj | add-member noteproperty -name "item size (mb)" -value $stats.totalitemsize.value.tomb()
$userobj | add-member noteproperty -name "deleted item size (mb)" -value $stats.totaldeleteditemsize.value.tomb()
$userobj | add-member noteproperty -name "items" -value $stats.itemcount
$userobj | sort-object -descending
any suggestions?
thanks in advance.
try this:
$userobj | sort-object "item size (mb)" -descending
al dunbar -- remember 'mark or propose answer' or 'vote helpful' appropriate.
Windows Server > Windows PowerShell
Comments
Post a Comment