Archive for the ‘Office 365’ Category

Scripting to prepare migration user gmail to o365

February 25, 2017 1 comment

a few days ago I got the project to implement migration from google to o365 incude mailbox and onedrive online, we have done migration data mailbox using third party, but this post i dont want to discuss how to migration the data from google to o365 but I want to share step by step to migration the users using scripting while users will be moved to o365

just for information we have to change the domain from to

  1. Create forwarding users in gmail to forward users o365, here i dont have script to enable forwarding in gmail because i dont have experience in gmail
  2. Remove-MailContact -Identity “” -confirm:$false previously we create all contact in gmail because for this implementation we didnt migration big bang, so we have migration for partial users,
  3. set-aduser “deby” -clear msexchhidefromaddresslists we need to clear exchange address list in proxy SMTP address because we will create new smtp proxy address will be defined
  4. Get-Aduser -identity “deby” | Set-aduser -Clear Proxyaddresses yes we need step to clear proxy addres
  5. Get-Aduser -identity “deby” | Set-aduser -add @{proxyaddresses = “”} we need add SMTP proxy address will be defined
  6. Running delta azure AD Connect, because primary address SMTP on active directory need sync to o365
  7. Set-MsolUserPrincipalName -UserPrincipalName “” -NewUserPrincipalName “” we need to change UPN existing from to
  8. Get-Aduser -identity “deby” | Set-aduser -add @{proxyaddresses = “”}  we need add additional SMTP previously to be secondary SMTP address to o365
Categories: Office 365




set a send/receive message size limit of 150MB for new mailboxes when they are created. The mailbox plan can be updated with that new setting as follows.


Get information exisiting setting mailbox user for message limited send and receive


modify all of your mailboxes you can pipe Get-Mailbox into Set-Mailbox as follows.


To modify a single mailbox we can simply run Set-Mailbox as follows.



Categories: Office 365

Enable Ediscovery inplace hold and Litigation hold office365 using powershell

April 27, 2016 Leave a comment

before enable ediscovery inplace hold and litigation hold you must to connect Microsoft Online using Windows Azure Active Directory Module for windows Powershell,

here step by step to enable ediscovery in place hold and litigation hold

  1. On your local computer, open Windows PowerShell and run the following command.
    $UserCredential = Get-Credential
  2. Run the following command.
    $Session = New-PSSession -ConfigurationName Microsoft.Exchange 
    -ConnectionUri -Credential 
    $UserCredential -Authentication Basic -AllowRedirection
  3. Run the following command.
    Import-PSSession $Session
  4. Enable Edisocver Inplace hold
    New-MailboxSearch "deby sandra" -sourcemailboxes "" 
    -estimateonly -InplaceHoldEnabled $true
  5. Start Mailbox-search
     Start-MailboxSearch -Identity "deby sandra"
  6. Please confirm Yes
  7. enable Litigationhold
    Set-Mailbox -LitigationHoldEnabled $true

    please makesure that ediscovery in hold and litigation hold enable in the portal office365,

  8. Check Inplace hold27-04-2016 10-58-34

Check Litigation Hold Enabled27-04-2016 11-06-47

here for example command to enabled ediscovery hold and litigation hold

27-04-2016 11-09-33

add -force to disable prompt confirmation


Categories: Office 365, Windows Client

Export unlicense user O365 base on only Display Name and User Principal Name

March 29, 2016 Leave a comment

PS C:\> Get-MSOLUser -UnlicensedUsersOnly | select displayname,userprincipalname
| Export-CSV c:\userlist.csv

Categories: Office 365

Exporting a list of unlicensed users Office 365 to a CSV file

March 29, 2016 Leave a comment

#Exporting a list of unlicensed users to a CSV file.

#This first command will import the Azure Active Directory module into your PowerShell session.
Import-Module MSOnline

#Capture administrative credential for future connections.
$credential = get-credential

#Establishes Online Services connection to Azure Active Directory  
Connect-MsolService -Credential $credential

#Create a CSV export file of unlicensed users for your review. 
Get-MsolUser -UnlicensedUsersOnly | export-csv c:\reports\Unlicensed_Users.CSV
Categories: Office 365, Windows Client

Office 365 PowerShell Tip: Bulk change UPN’s

February 26, 2016 2 comments

Sometimes you may provision accounts in Office 365 before any sort of domain validation.  In this case, you don’t want to hit up each user account and manually change the UPN one at a time, possibly leading to setting something incorrectly.  We’re going to give you some PowerShell code you can cut and paste to make this change.  This code will effectively:

  1. Change the domain portion of the UPN to the domain of your choice
  2. Not change the UPN of the admin account (we determine this by ignoring any UPN that begins with “admin@”).  Normally you aren’t going to change the admin account UPN to your own domain and will leave it as the address.

Here’s a quick two line PowerShell command you can do to change all of the UPN’s in your account:

  1. Install the Office 365 PowerShell modules
  2. Launch the command shell from the start menu (Start → All Programs → Microsoft Online Services → Microsoft Online Services Module for Windows PowerShell)
  3. Copy and paste the following into the window (replace with your own domain)


Get-MsolUser -all | Where { -Not $_.UserPrincipalName.ToLower().StartsWith(“admin@”) } | ForEach { Set-MsolUserPrincipalName -ObjectId $_.ObjectId -NewUserPrincipalName ($_.UserPrincipalName.Split(“@”)[0] + “”) }

As you can see, PowerShell is a very powerfull tool to perform bulk operations.



Categories: Office 365