Exchange 2010: Determine Active Sync devices and write to CSV file

The following script can be used to determine all users with Active Sync devices. The data is then written to a CSV file.

#Ppath to the CSV file for export
$exportfile = "c:\export.csv"

#Name of a mailbox database or "all" to include all mailbox databases
$database = "all"

#—————————————————————

"User;Type;Serial number;Status" | set-content "$exportfile"
if ($database -eq "all")
{
$mailboxes = get-MailboxDatabase | get-mailbox -ResultSize Unlimited
}
else
{
$mailboxes = get-MailboxDatabase "$database" | get-mailbox -ResultSize Unlimited
}

foreach ($mailbox in $mailboxes)
{
$devices = Get-ActiveSyncDevice -Mailbox $mailbox
foreach ($device in $devices)
{
$user = $mailbox.Name
$deviceSerial = $device.DeviceId
$DeviceType = $device.DeviceType
$DeviceState = $device.DeviceAccessState
if ($DeviceType -ne $NULL)
{
write-host "$user;$DeviceType;$deviceSerial;$DeviceState"
"$user;$DeviceType;$deviceSerial;$DeviceState" | add-content "$exportfile"
}
}
}

# www.frankysweb.de

6 thoughts on “Exchange 2010: Active Sync Geräte ermitteln und in CSV-Datei schreiben”

  1. Hallo,
    vielen Dank für das hilfreiche Script.
    Aber: um den Parameter „lastsuccesssync“ auslesen zu können, muss man unter Exchange 2010 den Befehl Get-ActiveSyncDeviceStatistics verwenden.

    Mit freundlichem Gruß

    Frank Haarmann

    Reply
  2. Hallo,

    können wir über die Liste auch ein Datumsfeld mit letztem Kontakt/Synchronisation einpflegen? Das wäre noch hilfreich!

    Reply

Leave a Comment