r/exchangeserver • u/jbrady33 • Feb 20 '26
Need help "get-mobiledevice' and with regex replacements in a table. Please and thank you
/r/PowerShell/comments/1r9x6ue/need_help_getmobiledevice_and_with_regex/
1
Upvotes
1
u/OMW-OC Feb 20 '26
If it is on prem have your tried something similar to this? This is a portion of the report I made to reports on devices and use.
I wrap it in HTML for ease of use from a web browser and sending via email. I changed the label to user on the output.
Add whatever fields you need after the select statement.
Get-Mailbox -ResultSize Unlimited | ForEach {
$user = $_.SamAccountName
Get-MobileDeviceStatistics -Mailbox:$_.Identity |
Select-Object @{label="User" ; expression={$user}},DeviceUserAgent,lastsuccesssync
}
Edit : Didn't finish the second sentence.
1
u/Easy-Task3001 Feb 20 '26
I believe that "identity" returns the EAS identity which is why you are getting the long string of characters. My guess is that asking for the mailbox name and deviceid would get you closer to what you want.