While trying to write some maintenance scripts for our Exchange 2013 deployment, one of the ones I need is a script that will determine which server a database is currently active on, versus which one it should be active on.
Easy enough, except that I've run into a syntax I've not seen before, and can't figure out how to get the data I need from this. When I run the command Get-MailboxDatabase Database1 | Select ActivationPreference, the output I get looks like this:
{[Server1, 1], [Server2, 2]}
Now, I know what this means (Server1 is the preferred server to host the active copy of this database), but for my script I need to be able to extract that data -- and I can't figure that out. Array access can easily get me the first pair ([Server1, 1]), which is a System.Collections.Generic.KeyValuePair, but I'm a relative newbie to PowerShell and even to .NET in general and can't figure out what this means or how to get the information I need out of it.
What commands/methods/operators/etc exist that can extract the key in a key-value pair like this?