Customattribute query


is there way query mailbox customattribute set ?

for solution ugly, , i'm sure there better one

get-mailbox |  ? {$_.customattribute1} | sort customattribute1 | ft name,customattribute1
get-mailbox |  ? {$_.customattribute2} | sort customattribute2 | ft name,customattribute2
get-mailbox |  ? {$_.customattribute3} | sort customattribute3 | ft name,customattribute3
get-mailbox |  ? {$_.customattribute4} | sort customattribute4 | ft name,customattribute4
get-mailbox |  ? {$_.customattribute5} | sort customattribute5 | ft name,customattribute5
get-mailbox |  ? {$_.customattribute6} | sort customattribute6 | ft name,customattribute6
get-mailbox |  ? {$_.customattribute7} | sort customattribute7 | ft name,customattribute7
get-mailbox |  ? {$_.customattribute8} | sort customattribute8 | ft name,customattribute8
get-mailbox |  ? {$_.customattribute9} | sort customattribute9 | ft name,customattribute9
get-mailbox |  ? {$_.customattribute10} | sort customattribute10 | ft name,customattribute10
get-mailbox |  ? {$_.customattribute11} | sort customattribute11 | ft name,customattribute11
get-mailbox |  ? {$_.customattribute12} | sort customattribute12 | ft name,customattribute12
get-mailbox |  ? {$_.customattribute13} | sort customattribute13 | ft name,customattribute13
get-mailbox |  ? {$_.customattribute14} | sort customattribute14 | ft name,customattribute14
get-mailbox |  ? {$_.customattribute15} | sort customattribute15 | ft name,customattribute15

not tested:

1..15 | % { get-mailbox | ? {$_.customattribute1} | sort customattribute$_ | ft name,customattribute$_}



Windows Server  >  Windows PowerShell



Comments

Popular posts from this blog

Error: 0x80073701 when trying to add Print Services Role in Windows 2012 Standard

Disconnecting from a Windows Server 2012 R2 file sharing session on a Windows 7,8,10 machine

Windows 2016 RDS event 1306 Connection Broker Client failed to redirect the user... Error: NULL