July 2017
Intermediate to advanced
648 pages
31h 9m
English
The first thing we'll do is create a collection of mailbox objects that will be used as the data source for a new set of custom objects:
$mailboxes = Get-Mailbox
You can add custom properties to any object coming across the pipeline using calculated properties. This can be done using either the Select-Object or Format-Table together with the -AutoSize parameter:
$mailboxes |
Format-Table Name,
Database,
@{name="Title";expression={(Get-User $_.Name).Title}},
@{name="Dept";expression={(Get-User $_.Name).Department}} -AutoSize
Another easy way to do this is by assigning a hash table to the -Property parameter of the New-Object cmdlet:
$mailboxes | %{ New-Object PSObject -Property @{ Name = $_.Name Database = $_.Database ...Read now
Unlock full access