Using powershell to disable O365 POP and IMAP from a user CSV list

Super Contributor

How to use powershell to disable O365 POP and IMAP from a user CSV list?

 

thanks

 

 

2 Replies

@Marvin Oco You can use the Set-CASMailbox -Identity <UPN> -PopEnabled $false -ImapEnabled $false

@Marvin Oco 

 

Consider the CSV file "Users.csv" which contains username (or upn) of users with the column header UserPrincipalName and try the below commands.

Import-Csv 'C:\Users.csv' | ForEach-Object {
Set-CASMailbox -Identity $_."UserPrincipalName" -PopEnabled $false -ImapEnabled $false
}