Author Posts

February 16, 2015 at 9:32 am

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.

Thanks

February 16, 2015 at 6:04 pm

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.

February 20, 2015 at 11:44 am

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?

February 20, 2015 at 8:18 pm

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=",""
$Name

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.

February 23, 2015 at 7:54 am

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