Solved

Exchange 2010 SP3 RU2 ActiveSync Powershell commands

Posted on 2014-10-10
2
140 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

Does Powershell have you tied up in knots?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

Question has a verified solution.

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

The Nano Server Image Builder helps you create a custom Nano Server image and bootable USB media with the aid of a graphical interface. Based on the inputs you provide, it generates images for deployment and creates reusable PowerShell scripts that …
This article will help to fix the below error for MS Exchange server 2010 I. Out Of office not working II. Certificate error "name on the security certificate is invalid or does not match the name of the site" III. Make Internal URLs and External…
In this video we show how to create an Address List 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 Organization >> Ad…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

705 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