My Developer blog

Welcome to my blog, I wanted a place that I could document and share all my development experiences and if it helps people on the way all the better. this is the beginning of the site but I have lots of ideas and will constantly add to it and hopefully blog about it on the way.

Before we start

1 - You will need to have an Office 365 subscription or trail account, you can get set up on an E3 account through this link and hitting the free trail, this will give you access to everything that you need to follow along…

2 - You can use PowerShell, PowerShell ISE or Windows Azure Active Directory model

3 - Whatever you use you may have to run start by using the following command and click on Yes\Yes to all

SET-ExecutionPolicy Unrestricted 

4 - Whatever you use you may have to run start by using the following command and click on Yes\Yes to all

Connecting to Office 365 - please read this post on how to connect to office 365 and it's services.

Note This list below is just a few of the many, many commands that are out there, the commands below are the main commands i have been learning for the exams... If you would like more follow this link


$UserCredential = Get-Credential
$Session = New-PSSession -ConfigurationName Microsoft.Exchange 
-Credential $UserCredential -Authentication Basic -AllowRedirection
Import-PSSession $Session

Get Mailbox


Add a new email address

Set-mailbox dcwtch -WindowsEmailaddress

# To add a new email address to an existing one

Set-mailbox -Identity 
-EmailAddress @{add=""}

# To remove an address

Set-mailbox -Identity 
-EmailAddress @{remove=""}

New shared mailbox

New-Mailbox -DisplayName "Beta" Alais 
-PrimarySMTPAddress -Name beta -Shared

Adding Permissions

Add-MailboxPermission -Identity beta 
-User -AccessRights FullAccess

Grant Send on Behalf Permissions

Set-Mailbox -Identity "Support" 

Activate Archiving for all users

Get-Mailbox –resultsize unlimited |
Where-Object { $_.RecipientTypeDetails -eq "UserMailbox"} | 
Enable-Mailbox -Archive

List all Lync Addresses

Get-Mailbox -ResultSize Unlimited | 
Select-Object –ExpandProperty EmailAddresses |
where-object {$_ -match “SIP”}

Configure Retention Policy and Apply it to a user's mailbox

New-RetentionPolicy -Name "90 Days Junk Removal"
New-RetentionPolicyTag "Junk Remove" -Type DeletedItems 
-RetentionEnabled 1 -AgeLimitForRetention 90 
-RetentionAction DeleteAndAllowRecovery
Set-RetentionPolicy "90 Days Junk Removal" 
–RetentionPolicyTagLinks "Junk Remove"
Set-Mailbox dcwtch -RetentionPolicy "90 Days Junk Removal"
Start-ManagedFolderAssistant dcwtch

Add alternative mail address

Set-Mailbox -Identity 
-EmailAddresses @{add=""}

Add new primary email address

Set-Mailbox dcwtch 

Configure Archiving for all user Mailboxes

Get-Mailbox –resultsize unlimited | 
Where-Object { $_.RecipientTypeDetails -eq "UserMailbox"} | 
Enable-Mailbox -Archive

Enable Litigation Hold

Set-Mailbox dcwtch -LitigationHoldEnabled 1

Display Paired Active Sync users with Device

$ActivSyncUser=Get-CASMailbox -Filter {HasActiveSyncDevicePartnership 
-eq $true} Get-ActiveSyncDevice 
-Identity ($ActivSyncUser._Name)|fl userdisplayname,devicetype

Adding a MailTip

Set-Mailbox beta -MailTip "This is a mailTip"

Managing mail-enabled security groups

New-DistributionGroup -Name "File security Managers" 
-Alias fsadmin -Type security

# To show information about the new security group

Get-DistributionGroup File security Managers | FL Name, 

Managing mail-enabled distribution groups

New-Distribution -Name "IT Administrators" 
-Alias itadmin -MemberJoinRestruction open

Managing Dynamic Distribution groups

New-DynamicDistributionGroup -IncludedReciepients mailboxUsers 
-Name "Sales Users Dynamic Group" -Department Sales

To view information

Get-DynamicDistributionGroup -Identity "Marketing" | Formal-List

Managing room mailboxes

New-Mailbox -Name "First Floor Conference Room" -Room

# To configure the room mailbox

Set-CalendarProcessing "First Floor Conference Room" 
-AtomateProcessing AutoAccept

Managing resource mailboxes

New-Mailbox -Name "Demonstration laptop" -Equipment

# To configure the equipment mailbox

Set-CalendarProcessing "Demonstration laptop" 
-Automateprocessing AutoAccept

Managing mail contacts

New-maiContact -Name "Fred" -displayName "Frederick" 

# To Edit

Get-MailContact -Identity Fred | Format-List

Bulk importing contacts

Import-Csv .\ExternalContacts.csv|%{New-MailContact 
-Name $_.Name -DisplayName $_.Name 
-ExternalEmailAddress $_.ExternalEmailAddress 
-FirstName $_.FirstName -LastName $_.LastName}

## The contacts will now appear in the GAL. Next, you can add further information about each contact by

## running the import-CSV cmdlet again. This time, it is a two-stage process, beginning with this cmdlet:

$Contacts = Import-CSV .\externalcontacts.csv

## This command imports all the entries in the .csv file into a variable called $Contacts. Next, the following

## script replaces each value in the contact record with the new value in the .csv file:

$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 
-OtherTelephone $_.OtherTelephone -Department $_.Department -Fax $_.Fax
-Initials $_.Initials -Notes $_.Notes -Office $_.Office -Manager $_.Manager}