locked
Help With Script to ID Android users RRS feed

  • Question

  • Hello,

    The script below will retrieve all phones with Android as the device type but I haven't been able to get it to retrieve all *droid" phones using -like "*droid*" or -contains "*droid*". Any idea what I am missing? Thanks, Robert

    Get-CASMailbox -ResultSize unlimited -Filter{(HasActive
    SyncDevicePartnership -eq $true) -AND (name -notlike "cas_*") -AND (name -notlik
    e "DiscoverysearchMailbox*")} | ForEach {Get-ActiveSyncDeviceStatistics -Mailbox
    :$_.Identity | Where-Object {$_.devicetype -like "android"} }

    Tuesday, April 17, 2012 7:47 PM

Answers

  • Here we go:

    Get-CASMailbox -ResultSize unlimited -Filter{(HasActiveSyncDevicePartnership -eq $true) -AND (name -notlike "cas_*") -AND (name -notlik e "DiscoverysearchMailbox*")} | ForEach {Get-ActiveSyncDeviceStatistics -Mailbox:$_.Identity | Where-Object {[string]$_.devicetype -like "droid"} }

    '[string]' and '-like' were the keys. Not sure why [string] was required.

    Thanks!

    • Marked as answer by RTEAL Wednesday, April 18, 2012 3:16 AM
    Wednesday, April 18, 2012 3:16 AM

All replies

  • Why not something like this?

    Get-ActiveSyncDevice -Filter {deviceos -like '*android*'}



    Mike Crowley | MVP
    My Blog -- Planet Technologies

    • Marked as answer by RTEAL Tuesday, April 17, 2012 10:16 PM
    • Unmarked as answer by RTEAL Tuesday, April 17, 2012 10:16 PM
    Tuesday, April 17, 2012 9:26 PM
  • Sorry, I should have mentioned that we are using Exchange 2007.
    Tuesday, April 17, 2012 10:17 PM
  • Here we go:

    Get-CASMailbox -ResultSize unlimited -Filter{(HasActiveSyncDevicePartnership -eq $true) -AND (name -notlike "cas_*") -AND (name -notlik e "DiscoverysearchMailbox*")} | ForEach {Get-ActiveSyncDeviceStatistics -Mailbox:$_.Identity | Where-Object {[string]$_.devicetype -like "droid"} }

    '[string]' and '-like' were the keys. Not sure why [string] was required.

    Thanks!

    • Marked as answer by RTEAL Wednesday, April 18, 2012 3:16 AM
    Wednesday, April 18, 2012 3:16 AM