I have a list of ActiveSync ID's, and I need to block and remove them. How can I lookup the matching mailboxes and block and remove just those in the text file... leaving any others intact?
The sample text file referenced in the code below only contains a single sample ID I need to remove, without a header. The first issue I have is that it's not placing the ID into $DeviceID. I'm also not sure this will only leave any other devices alone.
Am I close?Add-PSSnapin Quest.ActiveRoles.ADManagement Add-PSSnapin Microsoft.Exchange.Management.PowerShell.E2010 Add-PSSnapin Microsoft.Exchange.Management.Powershell.Support $DeviceIDs = Import-csv .\RemoveActiveSyncDeviceIDs.txt | foreach-object { $user = get-qaduser -includedproperties msExchMobileAllowedDeviceIDs -sizelimit 0 | where {$_.msExchMobileAllowedDeviceIDs -match $DeviceIDs} Set-CASMailbox -Identity $user.DN -ActiveSyncBlockedDeviceIDs $DeviceIDs }