TechShizz | All posts tagged 'Office 365'

Office 365: Security, Distribution and Dynamic Distribution groups - (Power Shell)

Create and view a mail-enabled security group

New-DistributionGroup -Name "GroupA" -alias groupa -Type security

Get-DistributionGroup GroupA | FL Name,RecipientTypeDetails,PrimarySmtpAddress

Create a mail-enabled distributiongroup

New-DistributionGroup -Name "GroupB" -Alias groupb -MemberJoinRestriction open

Create and view a dynamic distributiongroup

New-DynamicDistributionGroup -IncludeRecipients MailboxUsers -Name "Marketing Dynamic Group" -Department Marketing

How do we know this worked?

Get-DynamicdistributionGroup -Identity "Marketing" | Format-List

Working with Mail Contacts (PowerShell)

Create contacts with a CSV files

Import-CSV "C:\Contacts.csv | %{New-MailContact -Name $_.Name -DisplayName %_.Name -ExternalEmailAddress $_.ExternalEmailAddress -FirstName $_.FirstName -LastName $_.LastName}
Add more information to each existing contact using a CSV file

$Contacts = Import-CSV "C:\UpdateContacts.csv"

$Contacts | ForEach {Set-Contact $_.Name -StreetAddress $_.StreetAddress -City $_.City -StateorProvince $_.Stateorprovince -PostalCode $_.Postalcode -Phone $ -MobilePhone $_.Mobilephone -Pager $_.Pager -HomePhone $_.HomePhone -Company $_.Company -Title $_.title}

Hide Contacts Using Power Shell
Set-MailContact -HiddenFromAddressListsEnabled $true

OR to set ALL contacts as hidden from GAL
Get-Contact -ResultSize unlimited -Filter {(RecipientTypeDetails -eq 'MailContact')} | Set-MailContact -HiddenFromAddressListsEnabled $True

Configure additional proxy addresses in PowerShell

Configure additional Proxy addresses
$users = Get-Mailbox
forech ($a in $users){$a.emailaddresses.add("smtp:$($.alias)@thenewdomainname")}
$users | %{Set-Mailbox.$_.Identity -Emailaddresses$_.EmailAddresses}

Configure Additional Addresses using a CSV file

Import-CSV "C:\addaddresses.csv" | ForEach {Set-Mailbox $_.Mailbox -EmailAddresses @{add$_.NewEmailAddress}}

Office 365: Configuring Malware Filters

Create a new malware filter

New-MalwareFilterPolicy -Name "Policy Name" -EnableInternalSenderAdminNotification $true -InternalSenderAdminAddress

Configure existing malware filter

Set-MalwareFilterPolicy -Identity "Policy Name"

Office 365: Configuring eDiscovery and In-Place Holds


  • Users must have the Exchange Online Plan 2 for eDiscovery to work.
  • Administrator must be a member of the "Discovery Management" role in Office 365

By default, office 365 creates a discovery mailbox but it will become necessary to create new discovery mailboxes.

Power Shell

Creating a discovery mailbox with 
New-Mailbox SearchResults -Discovery -PrimarySmtpAddress

Display available discovery mailboxes
Get-Mailbox -Resultsize unlimited -Filter {RecipientTypeDetails -eq "DiscoveryMailbox"}

Create In-Place Hold
New-MailboxSearch "SearchName" -SourceMailboxes "" -inplaceholdenabled $true