Solved

Exchange 2010 SP3 RU2 ActiveSync Powershell commands

Posted on 2014-10-10
2
136 Views
Last Modified: 2014-12-01
HI

does any one out there have a good power shell command or script that will give me the following information

1) Name
2) device name
3) device OS
4) device model
5) status of device

and so on


please let me know
0
Comment
Question by:SEHC
2 Comments
 
LVL 25

Expert Comment

by:Mohammed Khawaja
ID: 40373397
You could run the following script (credit goes to http://exchangeserverpro.com/forums/powershell-corner/17-get-list-all-activesync-users-info-exchange-2007-a.html):



$outObject = @()

$ActiveSyncMailboxes = Get-CasMailbox -Filter { HasActivesyncDevicePartnership -eq $true }

foreach ($CasMailbox in $ActiveSyncMailboxes) {

      $n = $CasMailbox.Name
      $dn = $CasMailbox.DisplayName
      $ma = $CasMailbox.PrimarySmtpAddress
      $id = $CasMailbox.Identity
      $exv = $CasMailbox.ExchangeVersion
      
      if ($exv -like "0.1 (8*") {
      
            $ActiveSyncDevices = Get-ActiveSyncDeviceStatistics -Mailbox $id
      
            foreach ($Device in $ActiveSyncDevices) {
                  $fst = $Device.FirstSyncTime
                  $lsat = $Device.LastSyncAttemptTime
                  $lss = $Device.LastSuccessSync
                  $dt = $Device.DeviceType
                  $did = $Device.DeviceID
                  $dua = $Device.DeviceUserAgent
                  $dm = $Device.DeviceModel
                  $dfn = $Device.DeviceFriendlyName
                  $dos = $Device.DeviceOS
                  $dosl = $Device.DeviceOSLanguage
                  $dpn = $Device.DevicePhoneNumber
            
                  $outObject += New-Object Object
                  $l = $outObject.length - 1
                  Add-Member -memberType NoteProperty -Name Name -Value $n -inputObject $outObject[$l]
                  Add-Member -memberType NoteProperty -Name DisplayName -Value $dn -inputObject $outObject[$l]
                  Add-Member -memberType NoteProperty -Name PrimarySmtpAddress -Value $ma -inputObject $outObject[$l]
                  Add-Member -memberType NoteProperty -Name Identity -Value $id -inputObject $outObject[$l]
                  Add-Member -memberType NoteProperty -Name FirstSyncTime -Value $fst -inputObject $outObject[$l]
                  Add-Member -memberType NoteProperty -Name LastSyncAttemptTime -Value $lsat -inputObject $outObject[$l]
                  Add-Member -memberType NoteProperty -Name LastSuccessSync -Value $lss -inputObject $outObject[$l]
                  Add-Member -memberType NoteProperty -Name DeviceType -Value $dt -inputObject $outObject[$l]
                  Add-Member -memberType NoteProperty -Name DeviceID -Value $did -inputObject $outObject[$l]
                  Add-Member -memberType NoteProperty -Name DeviceUserAgent -Value $dua -inputObject $outObject[$l]
                  Add-Member -memberType NoteProperty -Name DeviceModel -Value $dm -inputObject $outObject[$l]
                  Add-Member -memberType NoteProperty -Name DeviceFriendlyName -Value $dfn -inputObject $outObject[$l]
                  Add-Member -memberType NoteProperty -Name DeviceOS -Value $dos -inputObject $outObject[$l]
                  Add-Member -memberType NoteProperty -Name DeviceOSLanguage -Value $dosl -inputObject $outObject[$l]
                  Add-Member -memberType NoteProperty -Name DevicePhoneNumber -Value $dpn -inputObject $outObject[$l]
      
            }
      
      #Variablen leeren
      $fst = $null
      $lsat = $null
      $lss = $null
      $dt = $null
      $did = $null
      $dua = $null
      $dm = $null
      $dfn = $null
      $dos = $null
      $dosl = $null
      $dpn = $null
      
      }
      
      $n = $null
      $dn = $null
      $ma = $null
      $id = $null
      $exv = $null


}

$outObject > activesyncdevices.txt
0
 
LVL 16

Accepted Solution

by:
Rajitha Chimmani earned 500 total points
ID: 40373400
Please try the script below. This script scans all active sync enabled users and provides the device status

$Arrayobj = @()
$ASEnabledMailboxes = Get-CASMailbox -ResultSize unlimited -Filter {(ActivesyncEnabled -eq $True)}
Foreach($User in $ASEnabledMailboxes){
[string]$Name = $User.Name
[string]$SMTPAddress = $User.PrimarySMTPAddress
$DeviceStats = Get-ActiveSyncDeviceStatistics -Mailbox $SMTPAddress
if($DeviceStats -ne $null){
foreach($Device in $DeviceStats){
$Obj = New-Object -TypeName system.Object
$Obj | Add-Member -MemberType noteproperty -Name Name -Value $Name
$Obj | Add-Member -MemberType noteproperty -Name DeviceID -Value $Device.DeviceID
$Obj | Add-Member -MemberType noteproperty -Name DeviceOS -Value $Device.DeviceOS
$Obj | Add-Member -MemberType noteproperty -Name DeviceModel -Value $Device.DeviceModel
$Obj | Add-Member -MemberType noteproperty -Name DeviceType -Value $Device.DeviceType
$Obj | Add-Member -MemberType noteproperty -Name DeviceStatus -Value $Device.Status
$Obj | Add-Member -MemberType noteproperty -Name LastSync -Value $Device.LastSuccessSync
$Arrayobj += $Obj
}
}
}
$Arrayobj | Export-csv users.csv -NoTypeInformation

Open in new window

0

Featured Post

Promote certifications in your email signature

Has your company recently won an award or achieved a certification? They'll no doubt want to show it off. Email signature images used to promote certifications & awards can instantly establish credibility with a recipient and provide you with numerous benefits.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Learn to move / copy / export exchange contacts to iPhone without using any software. Also see the issues in configuration of exchange with iPhone to migrate contacts.
A brief introduction to what I consider to be the best editor for PowerShell.
In this video we show how to create an email address policy in Exchange 2013. We show this process by using the Exchange Admin Center. Log into Exchange Admin Center.:  First we need to log into the Exchange Admin Center. Navigate to the Mail Flow…
To show how to create a transport rule in Exchange 2013. We show this process by using the Exchange Admin Center. Log into Exchange Admin Center.: First we need to log into the Exchange Admin Center. Navigate to the Mail Flow >> Rules tab.:  To cr…

947 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now