question

NitechInc-0892 avatar image
0 Votes"
NitechInc-0892 asked ZhengqiLou-MSFT commented

Exchange Bulk import from .csv file to remove from Allow and then Allow.

Hello Genius Peeps,

My name is Mehul Mehta i am working as a software developer in Nitech stainless Inc.com so my question is

Thought maybe I could turn here for some help! Does anyone know of a Powershell script I could run on our Exchange server for to the following:

1) We would initially want to clear all or current mobile devices from all the users

2) Then re-add their specific mobile device ID that we received from them to the ALLOW list

Is there some sort of .csv and script I can create to make this process fast?

We found the following scripts to remove all from ALLOW and to add to ALLOW

Clear all Allow
Set-CASMailbox -Identity username -ActiveSyncAllowedDeviceIDs $null

Add to Allow
Set-CASMailbox -Identity username -ActiveSyncAllowedDeviceIDs @{add='DeviceId'}

And maybe after running this script if theres also a quick way to show the results were made to the accounts? Using this command? Get-CASMailbox -Identity username | fl activesync*

office-exchange-server-deployment
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

ZhengqiLou-MSFT avatar image
0 Votes"
ZhengqiLou-MSFT answered ZhengqiLou-MSFT commented

Hi @NitechInc-0892 ,

Have you ever tried this:

  Get-CASMailbox | Set-CASMailbox -ActiveSyncAllowedDeviceIDs $null
        
  Import-Csv C:\list.csv | 
  ForEach{
  try {
  Set-CASMailbox -Identity $_.UserName -ActiveSyncAllowedDeviceIDs $_.DeviceId -ErrorAction Stop
  Write-Output "Successfully Done $_" | Out-File "C:\added.csv" -Append
  }
  catch [System.Exception] 
  {
  Write-Output "$_" | Out-File "c:\error.csv" -Append
  }
  Finally
  {
  }}

Since your issue is same with this thread: https://docs.microsoft.com/en-us/answers/questions/359416/exchange-bulk-import-from-csv-file-to-remove-from.html
I think you could check it and if that doesn't meet your requirement, please let me know.

Best regards,
Lou


If the response is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi @NitechInc-0892 ,

Do the suggestions above help? If the issue has been resolved, please click “Accept as answer” to mark helpful reply as an answer, this will make answer searching in the forum easier and be beneficial to other community members as well.

Regards,
Lou


If the response is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

0 Votes 0 ·