SOLVED

How to disable IMAP/POP3 globally but excluding a specific mailbox?

%3CLINGO-SUB%20id%3D%22lingo-sub-319818%22%20slang%3D%22en-US%22%3EHow%20to%20disable%20IMAP%2FPOP3%20globally%20but%20excluding%20a%20specific%20mailbox%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-319818%22%20slang%3D%22en-US%22%3E%3CP%3EHi%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EWe%20want%20to%20disable%20IMAP%2FPOP3%20to%20entire%20organization%2C%20but%20allow%20a%20couple%20mailboxes%20to%20have%20those%20features.%20How%20can%20we%20approach%20it%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EPlease%20help!%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThanks%20in%20advance!%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-319818%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EOffice%20365%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-390821%22%20slang%3D%22en-US%22%3ERe%3A%20How%20to%20disable%20IMAP%2FPOP3%20globally%20but%20excluding%20a%20specific%20mailbox%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-390821%22%20slang%3D%22en-US%22%3Eis%20this%20also%20including%20Shared%20Mailboxes%20that%20are%20licensed%3F%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-320506%22%20slang%3D%22en-US%22%3ERe%3A%20How%20to%20disable%20IMAP%2FPOP3%20globally%20but%20excluding%20a%20specific%20mailbox%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-320506%22%20slang%3D%22en-US%22%3E%3CP%3EI%20called%20Microsoft%20today.%20There%20is%20the%20script%20to%20disable%20IMAP%2FPOP%20for%20all%20mailboxes%20expect%20abc%40abc.com.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EGet-CASMailbox%20-ResultSize%20Unlimited%20%7C%20where%20%7B%24_.Name%20-ne%20%22abc%22%7D%20%7C%20Set-CASMailbox%20-PopEnabled%20%24false%20-ImapEnabled%20%24false%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ENote%3A%20abc%20is%20the%20display%20name%20of%20mailbox%20abc%40abc.com.%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-320281%22%20slang%3D%22en-US%22%3ERe%3A%20How%20to%20disable%20IMAP%2FPOP3%20globally%20but%20excluding%20a%20specific%20mailbox%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-320281%22%20slang%3D%22en-US%22%3E%3CP%3EHi%20Vasil%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThank%20you%20for%20your%20reply.%20Below%20is%20the%20scrip%20that%20I%20found%20online%20and%20tested%20and%20it%20works.%20It%20will%20disable%20IMAP%2FPOP%20for%20all%20mailboxes.%20If%20I%20want%20to%20exclude%20mailbox%20abc%40abc.com%20in%20this%20script%2C%20can%20you%20help%20me%20to%20modify%20the%20script%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%24IMAPMBX%20%3D%20Get-CASMailbox%20-ResultSize%20Unlimited%20%7C%20%3F%7B(%24_.ImapEnabled%20-eq%20%24true)%20-or%20(%24_.PopEnabled%20-eq%20%24true)%7D%3C%2FP%3E%3CP%3E%24IMAPCount%20%3D%20%24IMAPMBX.count%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIf%20(%24IMAPCount%20-gt%20%220%22)%20%7B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20ForEach%20(%24I%20in%20%24IMAPMBX)%20%7B%3C%2FP%3E%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%24UPN%20%3D%20%24I.PrimarySMTPAddress%3C%2FP%3E%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%24Alias%20%3D%20%24Identity%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%22--------%5BIMAP%2FPOP%20Disable%5DStart%20Processing%20IMAP%2FPOP%20Disable%20for%20Mailbox%20%24UPN--------%22%20%7C%20Out-File%20-Filepath%20%24Logpath2%20-Append%3C%2FP%3E%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3Btry%20%7B%3C%2FP%3E%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%24error.Clear()%3C%2FP%3E%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3Bwrite-host%20%22Disable%20IMAP%2FPOP%20for%20mailbox%20%24UPN%22%20-ForegroundColor%20GREEN%3C%2FP%3E%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%22Disable%20IMAP%2FPOP%20for%20mailbox%20%24UPN%22%20%7C%20Out-File%20-FilePath%20%24LogPath2%20-Append%3C%2FP%3E%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20Set-CASMailbox%20-Id%20%24UPN%20-IMAPEnabled%20%24false%3C%2FP%3E%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20Set-CASMailbox%20-Id%20%24UPN%20-POPEnabled%20%24false%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%7D%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20Catch%20%7B%3C%2FP%3E%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3Bwrite-host%20%22ERROR%20-%20Disabling%20IMAP%2FPOP%20for%20%24UPN%22%20-ForeGroundColor%20RED%3C%2FP%3E%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%22ERROR%20-%20Disabling%20IMAP%2FPOP%20for%20%24UPN%22%20%7C%20Out-File%20-FilePath%20%24LogPath2%20-Append%3C%2FP%3E%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%24error%20%7C%20Out-File%20-FilePath%20%24LogPath2%20-Append%3C%2FP%3E%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%7D%3C%2FP%3E%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%7D%3C%2FP%3E%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%3C%2FP%3E%3CP%3E%7D%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThanks%20in%20advance!%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-320183%22%20slang%3D%22en-US%22%3ERe%3A%20How%20to%20disable%20IMAP%2FPOP3%20globally%20but%20excluding%20a%20specific%20mailbox%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-320183%22%20slang%3D%22en-US%22%3E%3CP%3EIt's%20almost%20certainly%20possible%2C%20as%20PowerShell%20is%20very%20flexible%2C%20however%20we%20cannot%20give%20you%20a%20specific%20answer%20without%20knowing%20all%20the%20details.%20One%20way%20would%20be%20to%20simply%20%22hardcode%22%20the%20addresses%20of%20these%20mailboxes%20as%20an%20exclusion%20in%20the%20script%2C%20so%20no%20matter%20how%20many%20times%20it%20runs%20it%20never%20toggles%20the%20setting%20on%2Foff.%20You%20can%20also%20generalize%20this%20to%20using%20a%20CSV%20file%20which%20the%20script%20reads%20from.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-319867%22%20slang%3D%22en-US%22%3ERe%3A%20How%20to%20disable%20IMAP%2FPOP3%20globally%20but%20excluding%20a%20specific%20mailbox%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-319867%22%20slang%3D%22en-US%22%3E%3CP%3EHi%20Chris%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThis%20will%20do%2C%20but%20I%20prefer%20automation.%20I%20wonder%20if%20it%20is%20possible%20to%20excluding%20the%20specific%20mailbox%20in%20the%20disable%20all%20mailbox%20script.%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EMaybe%20I%20should%20post%20on%20PowerShell%20forum.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThank%20you%20anyway!%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EBest%2C%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-319864%22%20slang%3D%22en-US%22%3ERe%3A%20How%20to%20disable%20IMAP%2FPOP3%20globally%20but%20excluding%20a%20specific%20mailbox%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-319864%22%20slang%3D%22en-US%22%3EYes%2C%20it%20just%20a%20Powershell%20script%20to%20disable%20the%20IMAP%2FPOP%20protocols%20on%20the%20mailbox.%3CBR%20%2F%3E%3CBR%20%2F%3ESo%20disable%20all%20once%3CBR%20%2F%3EEnable%20the%20ones%20you%20want%20once%3CBR%20%2F%3E%3CBR%20%2F%3EThen%20when%20you%20create%20the%20mailbox%20and%20run%20the%20Powershell%20script%20to%20disable%20that%20mailbox.%20Should%20take%20about%202%20minutes%20to%20do%2C%20That%20avoids%20the%20manual%20work%20of%20logging%20into%20the%20control%20panel%20and%20disabling%20them%20manually!%3CBR%20%2F%3E%3CBR%20%2F%3EHope%20that%20clarifies%20and%20gives%20you%20the%20answer%20you%20need.%3CBR%20%2F%3E%3CBR%20%2F%3EBest%2C%20Chris%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-319861%22%20slang%3D%22en-US%22%3ERe%3A%20How%20to%20disable%20IMAP%2FPOP3%20globally%20but%20excluding%20a%20specific%20mailbox%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-319861%22%20slang%3D%22en-US%22%3E%3CP%3EHi%20Chris%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EDo%20we%20need%20to%20do%20step%204%20manually%20every%20time%20when%20we%20create%20a%20new%20account%3F%26nbsp%3B%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThanks%2C%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-319860%22%20slang%3D%22en-US%22%3ERe%3A%20How%20to%20disable%20IMAP%2FPOP3%20globally%20but%20excluding%20a%20specific%20mailbox%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-319860%22%20slang%3D%22en-US%22%3EHi%20%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F74422%22%20target%3D%22_blank%22%3E%40Grace%20Yin%3C%2FA%3E%3CBR%20%2F%3E%3CBR%20%2F%3EWell%2C%20there%20is%20a%20probably%20an%20easier%20way%20than%20that.%20So%20you%20do%20the%20following%3CBR%20%2F%3E%3CBR%20%2F%3E1.)%20Disable%20all%20mailboxes%20with%20the%20Powershell%20script%20provided%20earlier%3CBR%20%2F%3E2.)%20Enable%20the%20ones%20you%20want%20with%20the%20Poweshell%20script%20provided%20earlier%3CBR%20%2F%3E%3CBR%20%2F%3EFor%20all%20new%20mailboxes%3CBR%20%2F%3E3.)%20Create%20new%20mailbox%3CBR%20%2F%3E4.)%20Disable%20IMAP%20and%20POP3%20on%20that%20new%20mailbox%20here%3CBR%20%2F%3E%3CBR%20%2F%3E%3CA%20href%3D%22https%3A%2F%2Fsupport.microsoft.com%2Fen-in%2Fhelp%2F2416434%2Fhow-to-enable-or-disable-pop3-imap-mapi-outlook-web%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Ehttps%3A%2F%2Fsupport.microsoft.com%2Fen-in%2Fhelp%2F2416434%2Fhow-to-enable-or-disable-pop3-imap-mapi-outlook-web%3C%2FA%3E...%3CBR%20%2F%3E%3CBR%20%2F%3EAfter%20you%20have%20done%201%20and%202%20you%20don't%20need%20to%20do%20them%20again.%20You%20just%20do%20actions%203%20and%204%20when%20you%20need%20to%20create%20a%20new%20mailbox.%3CBR%20%2F%3E%3CBR%20%2F%3EBest%2C%20Chris%3CBR%20%2F%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-319858%22%20slang%3D%22en-US%22%3ERe%3A%20How%20to%20disable%20IMAP%2FPOP3%20globally%20but%20excluding%20a%20specific%20mailbox%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-319858%22%20slang%3D%22en-US%22%3E%3CP%3EHi%20Chris%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThank%20you%20very%20much!%20I%20didn't%20get%20it%20earlier.%20Yes%2C%20this%20is%20exact%20what%20I%20want.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EJust%20want%20to%20confirm%20what%20the%20future%20mailbox%20means.%20Does%20it%20mean%20the%20new%20created%20mailbox%20after%20the%20first%20script%20running%3F%20Can%20I%20schedule%20the%20script%20to%20run%20daily%20so%20I%20don't%20have%20to%20manually%20run%20it%20every%20time%20after%20I%20create%20an%20account%3F%20Please%20advise!%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EMany%20thanks!%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-319852%22%20slang%3D%22en-US%22%3ERe%3A%20How%20to%20disable%20IMAP%2FPOP3%20globally%20but%20excluding%20a%20specific%20mailbox%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-319852%22%20slang%3D%22en-US%22%3EHi%20Grace%2C%3CBR%20%2F%3E%3CBR%20%2F%3EThe%20Powershell%20command%20here%20will%20disable%20for%20all%20future%20mailbox%20created%3CBR%20%2F%3E%3CBR%20%2F%3E%3CA%20href%3D%22https%3A%2F%2Fgcits.com%2Fknowledge-base%2Fdisable-pop-imap-mailboxes-office-365%2F%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fgcits.com%2Fknowledge-base%2Fdisable-pop-imap-mailboxes-office-365%2F%3C%2FA%3E%3CBR%20%2F%3E%3CBR%20%2F%3E1.)%20Disable%20all%20mailboxes%3CBR%20%2F%3E2.)%20Enable%20the%20ones%20you%20want%3CBR%20%2F%3E3.)%20Disable%20all%20future%20mailboxes%3CBR%20%2F%3E%3CBR%20%2F%3EBest%2C%20Chris%3CBR%20%2F%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-319847%22%20slang%3D%22en-US%22%3ERe%3A%20How%20to%20disable%20IMAP%2FPOP3%20globally%20but%20excluding%20a%20specific%20mailbox%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-319847%22%20slang%3D%22en-US%22%3E%3CP%3EHi%20Chris%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EYour%20second%20option%20can%20do%20it%2C%20however%20we%20will%20need%20to%20disable%20IMAP%2FPOP%20for%20the%20new%20created%20mailboxes%20manually%20whenever%20we%20creating%20a%20new%20account.%20We%20want%20to%20automate%20it.%20My%20ideal%20is%20to%20schedule%20a%20daily%20task%20to%20disable%26nbsp%3B%3CSPAN%3EIMAP%2FPOP%20for%20all%20mailboxes%20but%20excepting%20the%20specific%20mailboxes.%20I%20just%20don't%20know%20how%20to%20add%20the%20excluding%20mailbox%20command.%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%3EThanks%2C%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-319835%22%20slang%3D%22en-US%22%3ERe%3A%20How%20to%20disable%20IMAP%2FPOP3%20globally%20but%20excluding%20a%20specific%20mailbox%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-319835%22%20slang%3D%22en-US%22%3EHi%20Grace%2C%3CBR%20%2F%3E%3CBR%20%2F%3EIf%20you%20aren't%20good%20at%20Powershell%20then%20rather%20and%20try%20writing%20a%20script%20(unless%20someone%20in%20this%20forum%20provides%20you%20with%20one)%20I%20would%20disable%20the%20protocols%20in%20the%20Exchange%20Online%20admin%20portal%20for%20the%20selected%20users%20or%20use%20powershell%20to%20disable%20all%20users%20then%20immediately%20after%20enable%20the%20protocols%20on%20the%20few%20mailboxes%20you%20need%20with%20this%20article%3CBR%20%2F%3E%3CBR%20%2F%3E%3CA%20href%3D%22https%3A%2F%2Fsupport.microsoft.com%2Fen-in%2Fhelp%2F2416434%2Fhow-to-enable-or-disable-pop3-imap-mapi-outlook-web-app-or-exchange-ac%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Ehttps%3A%2F%2Fsupport.microsoft.com%2Fen-in%2Fhelp%2F2416434%2Fhow-to-enable-or-disable-pop3-imap-mapi-outlook-web-app-or-exchange-ac%3C%2FA%3E%3CBR%20%2F%3E%3CBR%20%2F%3EHope%20that%20helps%3CBR%20%2F%3E%3CBR%20%2F%3EBest%2C%20Chris%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-319827%22%20slang%3D%22en-US%22%3ERe%3A%20How%20to%20disable%20IMAP%2FPOP3%20globally%20but%20excluding%20a%20specific%20mailbox%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-319827%22%20slang%3D%22en-US%22%3E%3CP%3EHi%20Chris%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThank%20you%20very%20much%20for%20your%20reply.%20The%20link%20is%20very%20helpful.%20The%20only%20thing%20that%20I%20need%20help%20is%20how%20to%20exclude%20a%20specific%20mailbox%3F%20I%20am%20not%20good%20at%20PowerShell%2C%20if%20you%20can%20add%20the%20command%20of%20excluding%20mailbox%20like%20abc%40abc.com%2C%20that%20will%20be%20great!%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EYour%20help%20is%20appreciated!%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-319824%22%20slang%3D%22en-US%22%3ERe%3A%20How%20to%20disable%20IMAP%2FPOP3%20globally%20but%20excluding%20a%20specific%20mailbox%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-319824%22%20slang%3D%22en-US%22%3E%3CP%3EHi%20%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F74422%22%20target%3D%22_blank%22%3E%40Grace%20Yin%3C%2FA%3E%3CBR%20%2F%3E%3CBR%20%2F%3EThere%20are%20a%20few%20ways%20you%20could%20approach%20it%3CBR%20%2F%3E%3CBR%20%2F%3E1.)%20You%20could%20manually%20turn%20them%20off%20in%20the%20Exchange%20Admin%20Centre%20for%20each%20user.%20You%20would%20do%20this%20by%20going%20to%20recipients%2C%20selecting%20each%20mailbox%20and%20then%20turning%20off%20these%20mailbox%20protocols%3CBR%20%2F%3E%3CBR%20%2F%3E2.)%20You%20could%20do%20this%20with%20Powershell%2C%20either%20by%20writing%20a%20script%20which%20turns%20off%20these%20protocols%20for%20all%20selected%20users%20with%20the%20exception%20of%20the%20ones%20you%20need%2C%20or%20disable%20the%20protocols%20on%20all%20mailboxes%20via%20Powershell%20commands%20(link%20below)%20and%20then%20turning%20the%20protocols%20back%20on%20for%20the%20ones%20you%20want%2C%20again%20through%20Powershell%2C%20or%20by%20the%20Exchange%20Admin%20console.%3CBR%20%2F%3E%3CBR%20%2F%3E%3CA%20href%3D%22https%3A%2F%2Fgcits.com%2Fknowledge-base%2Fdisable-pop-imap-mailboxes-office-365%2F%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fgcits.com%2Fknowledge-base%2Fdisable-pop-imap-mailboxes-office-365%2F%3C%2FA%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThere%20is%20also%20a%20Uservoice%20to%20have%20them%20disabled%20by%20default%20in%20the%20future%2C%20as%20in%20when%20creating%20new%20mailboxes%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Foffice365.uservoice.com%2Fforums%2F273493-office-365-admin%2Fsuggestions%2F20454628-disable-imap-and-pop3-by-default%26nbsp%3B%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Ehttps%3A%2F%2Foffice365.uservoice.com%2Fforums%2F273493-office-365-admin%2Fsuggestions%2F20454628-disable-imap-and-pop3-by-default%26nbsp%3B%3C%2FA%3E%3C%2FP%3E%3CP%3E%3CBR%20%2F%3EHope%20that%20helps%20and%20answers%20your%20question.%3CBR%20%2F%3E%3CBR%20%2F%3EBest%2C%20Chris%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-755212%22%20slang%3D%22en-US%22%3ERe%3A%20How%20to%20disable%20IMAP%2FPOP3%20globally%20but%20excluding%20a%20specific%20mailbox%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-755212%22%20slang%3D%22en-US%22%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3Efyi%2C%20Configuring%20the%20CAS%20Mailbox%20Plan%20will%20help%20with%20future%20mailbox%20creations.%26nbsp%3B%3C%2FP%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fgcits.com%2Fknowledge-base%2Fdisable-pop-imap-mailboxes-office-365%2F%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%3Ehttps%3A%2F%2Fgcits.com%2Fknowledge-base%2Fdisable-pop-imap-mailboxes-office-365%2F%3C%2FA%3E%3C%2FP%3E%3CH3%20id%3D%22toc-hId-1595981915%22%20id%3D%22toc-hId-1509237251%22%3EDisabling%20IMAP%20and%20POP%20for%20all%20future%20mailboxes%3C%2FH3%3E%3CDIV%3E%3CDIV%20class%3D%22syntaxhighlighter%20%20powershell%22%3E%3CTABLE%20border%3D%220%22%20cellspacing%3D%220%22%20cellpadding%3D%220%22%3E%3CTBODY%3E%3CTR%3E%3CTD%3E%3CDIV%20class%3D%22line%20number1%20index0%20alt2%22%3E1%3C%2FDIV%3E%3C%2FTD%3E%3CTD%3E%3CDIV%20class%3D%22container%22%3E%3CDIV%20class%3D%22line%20number1%20index0%20alt2%22%3EGet-CASMailboxPlan%20-Filter%20%7BImapEnabled%20-eq%20%22true%22%20-or%20PopEnabled%20-eq%20%22true%22%20%7D%20%7C%20set-CASMailboxPlan%20-ImapEnabled%20%24false%20-PopEnabled%20%24false%3C%2FDIV%3E%3C%2FDIV%3E%3C%2FTD%3E%3C%2FTR%3E%3C%2FTBODY%3E%3C%2FTABLE%3E%3C%2FDIV%3E%3C%2FDIV%3E%3CH3%20id%3D%22toc-hId--956175046%22%20id%3D%22toc-hId--1042919710%22%3EDisabling%20IMAP%20and%20POP%20for%20all%20existing%20mailboxes%3C%2FH3%3E%3CDIV%3E%3CDIV%20class%3D%22syntaxhighlighter%20%20powershell%22%3E%3CTABLE%20border%3D%220%22%20cellspacing%3D%220%22%20cellpadding%3D%220%22%3E%3CTBODY%3E%3CTR%3E%3CTD%3E%3CDIV%20class%3D%22line%20number1%20index0%20alt2%22%3E1%3C%2FDIV%3E%3C%2FTD%3E%3CTD%3E%3CDIV%20class%3D%22container%22%3E%3CDIV%20class%3D%22line%20number1%20index0%20alt2%22%3EGet-CASMailbox%20-Filter%20%7BImapEnabled%20-eq%20%22true%22%20-or%20PopEnabled%20-eq%20%22true%22%20%7D%20%7C%20Select-Object%20%40%7Bn%20%3D%20%22Identity%22%3B%20e%20%3D%20%7B%24_.primarysmtpaddress%7D%7D%20%7C%20Set-CASMailbox%20-ImapEnabled%20%24false%20-PopEnabled%20%24false%3C%2FDIV%3E%3C%2FDIV%3E%3C%2FTD%3E%3C%2FTR%3E%3C%2FTBODY%3E%3C%2FTABLE%3E%3C%2FDIV%3E%3C%2FDIV%3E%3C%2FLINGO-BODY%3E
Frequent Contributor

Hi,

 

We want to disable IMAP/POP3 to entire organization, but allow a couple mailboxes to have those features. How can we approach it?

 

Please help!

 

Thanks in advance! 

15 Replies

Hi @Grace Yin

There are a few ways you could approach it

1.) You could manually turn them off in the Exchange Admin Centre for each user. You would do this by going to recipients, selecting each mailbox and then turning off these mailbox protocols

2.) You could do this with Powershell, either by writing a script which turns off these protocols for all selected users with the exception of the ones you need, or disable the protocols on all mailboxes via Powershell commands (link below) and then turning the protocols back on for the ones you want, again through Powershell, or by the Exchange Admin console.

https://gcits.com/knowledge-base/disable-pop-imap-mailboxes-office-365/

 

 

There is also a Uservoice to have them disabled by default in the future, as in when creating new mailboxes

 

https://office365.uservoice.com/forums/273493-office-365-admin/suggestions/20454628-disable-imap-and...


Hope that helps and answers your question.

Best, Chris

Hi Chris,

 

Thank you very much for your reply. The link is very helpful. The only thing that I need help is how to exclude a specific mailbox? I am not good at PowerShell, if you can add the command of excluding mailbox like abc@abc.com, that will be great!

 

Your help is appreciated! 

Hi Grace,

If you aren't good at Powershell then rather and try writing a script (unless someone in this forum provides you with one) I would disable the protocols in the Exchange Online admin portal for the selected users or use powershell to disable all users then immediately after enable the protocols on the few mailboxes you need with this article

https://support.microsoft.com/en-in/help/2416434/how-to-enable-or-disable-pop3-imap-mapi-outlook-web...

Hope that helps

Best, Chris

Hi Chris,

 

Your second option can do it, however we will need to disable IMAP/POP for the new created mailboxes manually whenever we creating a new account. We want to automate it. My ideal is to schedule a daily task to disable IMAP/POP for all mailboxes but excepting the specific mailboxes. I just don't know how to add the excluding mailbox command.

 

Thanks,

Hi Grace,

The Powershell command here will disable for all future mailbox created

https://gcits.com/knowledge-base/disable-pop-imap-mailboxes-office-365/

1.) Disable all mailboxes
2.) Enable the ones you want
3.) Disable all future mailboxes

Best, Chris

Hi Chris,

 

Thank you very much! I didn't get it earlier. Yes, this is exact what I want.

 

Just want to confirm what the future mailbox means. Does it mean the new created mailbox after the first script running? Can I schedule the script to run daily so I don't have to manually run it every time after I create an account? Please advise!

 

Many thanks!

Hi @Grace Yin

Well, there is a probably an easier way than that. So you do the following

1.) Disable all mailboxes with the Powershell script provided earlier
2.) Enable the ones you want with the Poweshell script provided earlier

For all new mailboxes
3.) Create new mailbox
4.) Disable IMAP and POP3 on that new mailbox here

https://support.microsoft.com/en-in/help/2416434/how-to-enable-or-disable-pop3-imap-mapi-outlook-web...

After you have done 1 and 2 you don't need to do them again. You just do actions 3 and 4 when you need to create a new mailbox.

Best, Chris

Hi Chris,

 

Do we need to do step 4 manually every time when we create a new account?  

 

Thanks,

Yes, it just a Powershell script to disable the IMAP/POP protocols on the mailbox.

So disable all once
Enable the ones you want once

Then when you create the mailbox and run the Powershell script to disable that mailbox. Should take about 2 minutes to do, That avoids the manual work of logging into the control panel and disabling them manually!

Hope that clarifies and gives you the answer you need.

Best, Chris

Hi Chris,

 

This will do, but I prefer automation. I wonder if it is possible to excluding the specific mailbox in the disable all mailbox script. 

 

Maybe I should post on PowerShell forum.

 

Thank you anyway! 

 

Best,

It's almost certainly possible, as PowerShell is very flexible, however we cannot give you a specific answer without knowing all the details. One way would be to simply "hardcode" the addresses of these mailboxes as an exclusion in the script, so no matter how many times it runs it never toggles the setting on/off. You can also generalize this to using a CSV file which the script reads from.

Hi Vasil,

 

Thank you for your reply. Below is the scrip that I found online and tested and it works. It will disable IMAP/POP for all mailboxes. If I want to exclude mailbox abc@abc.com in this script, can you help me to modify the script?

 

$IMAPMBX = Get-CASMailbox -ResultSize Unlimited | ?{($_.ImapEnabled -eq $true) -or ($_.PopEnabled -eq $true)}

$IMAPCount = $IMAPMBX.count

 

If ($IMAPCount -gt "0") {

 

    ForEach ($I in $IMAPMBX) {

   

        $UPN = $I.PrimarySMTPAddress

        $Alias = $Identity

 

        "--------[IMAP/POP Disable]Start Processing IMAP/POP Disable for Mailbox $UPN--------" | Out-File -Filepath $Logpath2 -Append

       

        try {

   

            $error.Clear()

       

            write-host "Disable IMAP/POP for mailbox $UPN" -ForegroundColor GREEN

            "Disable IMAP/POP for mailbox $UPN" | Out-File -FilePath $LogPath2 -Append

             Set-CASMailbox -Id $UPN -IMAPEnabled $false

             Set-CASMailbox -Id $UPN -POPEnabled $false

 

        }

 

        Catch {

   

            write-host "ERROR - Disabling IMAP/POP for $UPN" -ForeGroundColor RED

            "ERROR - Disabling IMAP/POP for $UPN" | Out-File -FilePath $LogPath2 -Append

            $error | Out-File -FilePath $LogPath2 -Append

                   

        }

   

    }

   

}    

 

Thanks in advance!

Best Response confirmed by Grace Yin (Frequent Contributor)
Solution

I called Microsoft today. There is the script to disable IMAP/POP for all mailboxes expect abc@abc.com.

 

Get-CASMailbox -ResultSize Unlimited | where {$_.Name -ne "abc"} | Set-CASMailbox -PopEnabled $false -ImapEnabled $false

 

Note: abc is the display name of mailbox abc@abc.com. 

is this also including Shared Mailboxes that are licensed?

 

 

fyi, Configuring the CAS Mailbox Plan will help with future mailbox creations. 

https://gcits.com/knowledge-base/disable-pop-imap-mailboxes-office-365/

Disabling IMAP and POP for all future mailboxes

1
Get-CASMailboxPlan -Filter {ImapEnabled -eq "true" -or PopEnabled -eq "true" } | set-CASMailboxPlan -ImapEnabled $false -PopEnabled $false

Disabling IMAP and POP for all existing mailboxes

1
Get-CASMailbox -Filter {ImapEnabled -eq "true" -or PopEnabled -eq "true" } | Select-Object @{n = "Identity"; e = {$_.primarysmtpaddress}} | Set-CASMailbox -ImapEnabled $false -PopEnabled $false