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

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"

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: Retention Tags and Policies

Retention Tag Types

  • Default policy tags - Automatically applied to an entire mailbox which has no other tags set.
  • Retention policy tags - Are applied to the default folders like 'Inbox' and 'Calendar'.
  • Personal Tags - Set manually through user assignments to both messages and folders.
Retention tags are linked to a retention policy and then the policy is linked to user mailboxes.

Power Shell

Connect to MSOnline Power Shell Module
Create a new retention tag
New-RetentionPolicyTag "Tag Name" -Type -AgeLimitForRetention -RetentionAction
New Retention Policy
New-RetentionPolicy -RetentionPolicyTagLinks
Change Policy for all Mailboxes
Get-Mailbox -ResultSize unlimited | Set-Mailbox -RetentionPolicy "RetentionPolicyName"
Change old retention policy to new one
$OldPolicy = {Get-RetentionPolicy "Old-Retention-Policy"}.distinguishedName
Get-Mailbox -Filter {RetentionPolicy -eq $OldPolicy} -Resultsize Unlimited | Set-Mailbox -RetentionPolicy "New-Retention-Policy"

How do we know it worked?
Get-Mailbox "Mailbox Name" | Select-RetentionPolicy

If we need to force the retention process to run for some reason this can be done with a power shell command only. The process which does the retention actions is called the 'Managed Folder Assistant' and is run periodically by default.

Start-ManagedFolderAssistant -Identity "Username"

Place a mailbox on retention hold
Set-Mailbox "Username" -RetentionHoldEnabled $true