Solved

Exchange 2010 SP3 RU2 ActiveSync Powershell commands

Posted on 2014-10-10
2
139 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Free Webinar: AWS Backup & DR

Join our upcoming webinar with experts from AWS, CloudBerry Lab, and the Town of Edgartown IT to discuss best practices for simplifying online backup management and cutting costs.

Question has a verified solution.

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

A list of top three free exchange EDB viewers that helps the user to extract a mailbox from an unmounted .edb file and get a clear preview of all emails & other items with just a single click on mailboxes.
A project that enables an administrator to perform actions within a user session context not just at the time of login but any time later on day(s) or week(s) later.
In this video we show how to create a Distribution Group 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 Recipients >>…
In this video we show how to create an Accepted Domain 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 >> Ac…

726 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