question

HansonIsaiahS-8335 avatar image
0 Votes"
HansonIsaiahS-8335 asked KyleXu-MSFT answered

Set DataEncryptionPolicy to all mailboxes in Exchange Online

Hi,

Everyday we need to run the following command for new users

Set-Mailbox -identity <UserID> -DataEncryptionPolicy <Our Policy>

Is there a way Exchange Online can automatically apply this to all mailboxes?

Thanks!

office-exchange-online-itpro
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

KyleXu-MSFT avatar image
0 Votes"
KyleXu-MSFT answered

@HansonIsaiahS-8335

For Exchange on-premises, you could using Scripting Agent to do it. But this function doesn't exist on Exchange online.

Here may be an another way for your:

Use Windows schedule task to the scripting below to connect to Exchange online and set mailbox daily:

 $User = "admin@domain.onmicrosoft.com"
 $PassWord = ConvertTo-SecureString -String "Password" -AsPlainText -Force
 $UserCredential = New-Object -TypeName "System.Management.Automation.PSCredential" -ArgumentList $User, $PassWord
    
 $Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $UserCredential -Authentication Basic -AllowRedirection
 Import-PSSession $Session -DisableNameChecking  
    
 Get-Mailbox | where{$_.DataEncryptionPolicy -eq $null} | Set-Mailbox -DataEncryptionPolicy "11111" 

About the using of schedule task, you could follow this blog: PowerShell Script


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.

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.