I'm getting mobile device stats from Exchange against each box, but get-mobiledevicestatistics unfortunately doesn't return a friendly name of the box it's retrieving — the closest thing is the Identity field, which spits out the full CN with the username crammed in the middle. Here's what I'm using:
$UserList = Get-CASMailbox -Filter {hasactivesyncdevicepartnership -eq $true -and -not displayname -like "CAS_{*"} | Get-Mailbox $UserList | foreach { Get-MobileDeviceStatistics -Mailbox $_.alias} | FL $userlist.Name, DeviceModel, LastSuccessSync
Is there a way to retrieve the name field from the initial command? The "$userlist.Name" throws this:
FL : Cannot convert System.Object[] to one of the following types {System.String,
System.Management.Automation.ScriptBlock}.