How do I list ActiveSync device users by manager

We are trying to make managers aware of who has users with email on their mobile devices whether company supplied or personal.

I have a task assigned to me. I am trying to learn PowerShell, but my skills are not up to this task yet.

I have been asked to get a list of all mobile devices and their owners/users connected to Exchange 2010 through ActiveSync.

Next step is to find the managers of the Mobile Device owners/users.

Then display/write a report showing Managers and their subordinates with devices connected to ActiveSync

I would like to be able to run the script and have it email the report to the managers.

I do have script that gives me User (FirstName LastName), PrimarySMTPAddress, DeviceType,Device Model, Device OS, lastSyncAttemptTime and LastSuccessSync

I can pull the User field but cannot seem to match it to Get-ADUser data

All help would be greatly appreciated.


All you need to do is match one of the attributes from the first script to a user attribute in AD. You could modify the first script to spit out a field like “SAMAccountName” or you could use some string parsing tricks with one of the attributes you have to query the AD user. If you’re still stuck it might help us to post your original script.

Ok I now have a the data I need in one csv file.

Now I have to take:

CN=Joe Bloggs,OU=Network,OU=IT,OU=Office,OU=XXXXXX,DC=xxx,DC=yyyyyyyyyyy,DC=com

and strip it down to leave Joe Bloggs

Any pointers?

Easy peasy

$DN = "CN=Joe Bloggs,OU=Network,OU=IT,OU=Office,OU=XXXXXX,DC=xxx,DC=yyyyyyyyyyy,DC=com"
$Name = $DN.split(",")[0] -replace "CN=",""

The split method breaks the string down into bite sized chunks and puts them into an array. [0] selects the first chunk in the array and the -replace takes out the bits you don’t want.

Thanks Jack. I will play with this and see what come out.

If it works the way I want it to, I will post the script here for all to see and hopefully refine further.

Thanks again