List all SMTP addresses with PowerShell

Open PowerShell > 


Get-Mailbox -ResultSize Unlimited |Select-Object DisplayName,ServerName,PrimarySmtpAddress, @{Name=“EmailAddresses”;Expression={$_.EmailAddresses |Where-Object {$_.PrefixString -ceq “smtp”} | ForEach-Object {$_.SmtpAddress}}}

Room and Equipment Mailboxes - AKA Resource Mailboxes - (PowerShell)

Create and Configure a room mailbox

New-Mailbox -Name "Meeting Room A" -Room

Set-CalendarProcessing -AutomateProcessing AutoAccept


Create and Configure an Equipement mailbox

New-Mailbox -Name "Loan Laptop 1" -Equipment

Set-CalendarProcessing -AutomateProcessing AutoAccept


Change Mailbox Type

Set-Mailbox -Type Regular

Get-Mailbox -Identity | Format-List RecipientTypeDetails

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 $_.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