Link to home
Start Free TrialLog in
Avatar of happyexchange
happyexchange

asked on

Exchange 2007 Actice sync

Hi we have over 100 users who have ipads and iphones on our exchange.  Is their a script i can use on Exchange 2007 to tell me what user has what device

Thank you
Avatar of rajkr2020
rajkr2020
Flag of India image

You could use the following:

The Active Sync Dveice doesn't have a user field to disply but it does have an Identity which does show the user/device. If the Identity is truncated, you could use :
Get-Mailbox | ForEach {Get-ActiveSyncDeviceStatistics -Mailbox:$_.Identity} | fl DeviceFriendlyName, Devicetype, DeviceUserAgent, Identity

Open in new window


Reference
ASKER CERTIFIED SOLUTION
Avatar of Hendrik Wiese
Hendrik Wiese
Flag of South Africa image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Akhater
This will give you what you want
$ActiveSyncDevices = @()
$Mailboxes = Get-CASMailbox -ResultSize:Unlimited | Where-Object {$_.HasActiveSyncDevicePartnership -eq $true}
 
ForEach ($Mailbox in $Mailboxes) {
   $devs = Get-ActiveSyncDeviceStatistics -Mailbox $Mailbox.Identity –ErrorAction SilentlyContinue 
   $devs | Select DeviceFriendlyName, Devicetype, DeviceUserAgent | ForEach-Object { 
      $_ | Add-Member –MemberType NoteProperty -Name "MailboxIdentity" -value $Mailbox
      $ActiveSyncDevices += $_ }
}
 
$ActiveSyncDevices | Export-csv c:\ActiveSyncDevices.csv

Open in new window

Download and install the log parsers
=============================

open logparser and after installing it in from start -- programfiles

run this command and Make sure you have IIS file
=================

logparser "SELECT cs-username AS UserID, cs(User-Agent) AS DeviceType, count (*) FROM c:\windows\system32\logfiles\w3svc1\ex*.log WHERE cs-uri-stem LIKE '%Microsoft-Server-ActiveSync%' AND cs-username IS NOT NULL GROUP BY UserID, DeviceType ORDER BY UserID" -rtp:-1 > C:\eas.csv

Note:
==========

Path in command : c:\windows\system32\logfiles\w3svc1\ex*.log\

This is the path for the IIS logs. If you have iis log file on u r desktop then give that path

You will have the output in the CSV file in C drive (EAS.CSV)
 
You could also export the results by adding the "| Export-csv c:\ActiveSyncReport.csv"

$mbx = get-casmailbox -Filter {HasActivesyncDevicePartnership -eq $true -and -not DisplayName -like "CAS_{*"}; $mbx | foreach {$name = $_.name; $device = get-activesync devicestatistics -mailbox $_.identity; $device | foreach {write-host $mbx.name, $_.devicemodel, $_.devicephonenumber, $_.deviceid, $_.FirstSyncTime, $_.LastSuccessSync} } | Export-csv c:\ActiveSyncReport.csv

Open in new window

Avatar of happyexchange
happyexchange

ASKER

Hi after running   $mbx = get-casmailbox -Filter {HasActivesyncDevicePartnership -eq $true -and -not DisplayName -like "CAS_{*"}; $mbx | foreach {$name = $_.name; $device = get-activesync devicestatistics -mailbox $_.identity; $device | foreach {write-host $mbx.name, $_.devicemodel, $_.devicephonenumber, $_.deviceid, $_.FirstSyncTime, $_.LastSuccessSync} } | Export-csv c:\ActiveSyncReport.csv

I get pls see below



The term 'get-activesync' is not recognized as the name of a cmdlet, function,
script file, or operable program. Check the spelling of the name, or if a path
was included, verify that the path is correct and try again.
At line:1 char:169
+ $mbx = get-casmailbox -Filter {HasActivesyncDevicePartnership -eq $true -and
-not DisplayName -like "CAS_{*"}; $mbx | foreach {$name = $_.name; $device = ge
t-activesync <<<<  devicestatistics -mailbox $_.identity; $device | foreach {wr
ite-host $mbx.name, $_.devicemodel, $_.devicephonenumber, $_.deviceid, $_.First
SyncTime, $_.LastSuccessSync} } | Export-csv c:\ActiveSyncReport.csv
    + CategoryInfo          : ObjectNotFound: (get-activesync:String) [], Comm
   andNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException
Sorry try it like this:

$mbx = get-casmailbox -Filter {HasActivesyncDevicePartnership -eq $true -and -not DisplayName -like "CAS_{*"}; $mbx | foreach {$name = $_.name; $device = Get-ActiveSyncDeviceStatistics -mailbox $_.identity; $device | foreach {write-host $mbx.name, $_.devicemodel, $_.devicephonenumber, $_.deviceid, $_.FirstSyncTime, $_.LastSuccessSync} } | Export-csv c:\ActiveSyncReport.csv

Open in new window

did you try my script ?
$ActiveSyncDevices = @()
$Mailboxes = Get-CASMailbox -ResultSize:Unlimited | Where-Object {$_.HasActiveSyncDevicePartnership -eq $true}
 
ForEach ($Mailbox in $Mailboxes) {
   $devs = Get-ActiveSyncDeviceStatistics -Mailbox $Mailbox.Identity –ErrorAction SilentlyContinue 
   $devs | Select DeviceFriendlyName, Devicetype, DeviceUserAgent | ForEach-Object { 
      $_ | Add-Member –MemberType NoteProperty -Name "MailboxIdentity" -value $Mailbox
      $ActiveSyncDevices += $_ }
}
 
$ActiveSyncDevices | Export-csv c:\ActiveSyncDevices.csv

Open in new window