Link to home
Start Free TrialLog in
Avatar of fletcher_l
fletcher_lFlag for United Kingdom of Great Britain and Northern Ireland

asked on

MS exchange 2007 Active Sync. Powershell help.

Hi again folks looking for additional help following my latest question.

In that question I wanted to know if I could default set active sync to disabled for my end users That aside for now here's my latest conundrum:

On this theme I want to do the following..
1.Identify all users with AS associated devices now
2.Identify of these who have not sync'd in the last 3 months
3.Output those that are active with association to file
4.Disable AS across all users
5.re-enable AS for users previously using it and meeting 3 month criteria using outputted file


Step 1. Get-Mailbox -ResultSize Unlimited | ForEach {Get-ActiveSyncDeviceStatistics -Mailbox:$_.Identity} | ft Identity, LastSuccessSync >c:\allowed.csv
Step 2. As above file is filtered in Excel by date and All those within 3 months are retained.
Step 3. Save above as csv file for use in step 5 All that will be in here is a single list with usernames.
Step 4. Set-CASMailbox -Identity "Joe Blo" -ActiveSyncEnabled $false
Step 5. Re-Enable Using allowed.csv

I need help building up in particular step 5.

Should I use an Import-csv and or a varible ($users = c:\allowed.csv)to call the csv list, maybe something else?

Help with the syntax of the commands would be helpful. I am not great with PS so would really appreciate spelling out the steps.

The csv file would be a single username column.
ASKER CERTIFIED SOLUTION
Avatar of SubSun
SubSun
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of fletcher_l

ASKER

Thanks Subsun that works great. I will look to tidy up later in order that it all becomes one neat job for me.