I am looking at pulling out a portion of a property from within the pipeline, but I cannot seem to get it. If I was using ISE or a ps1 file, I could just manipulate as needed and output, but I need this to be a one liner.
I am pulling Active sync devices across my domain, from exchange 2013 shell.
Get-Mailbox -RecipientTypeDetails UserMailbox -ResultSize Unlimited -Filter {HiddenFromAddressListsEnabled -eq $false} | %{Get-Mobiledevicestatistics -Mailbox $_.Identity} | select Identity
This will give me a path like result, with a "noteproperty" membertype. The output looks like this:
contoso.com/User_OU/User_Name/ExchangeActiveSyncDevices/Device
I want to return just User_Name from the output. If I do a split (on $identity being a string), and return the 3rd position of that split, I get the result I want.
{$identity.split('/')[2]}}
How would I incorporate this into the pipeline?