Archive

Posts Tagged ‘Office 365’

Manage Office 365 User licenses with Powershell

January 13, 2017 Leave a comment

Install required Software first

  • Install the 64-bit version of the Microsoft Online Services Sign-In Assistant – LINK
  • Install the 64-bit version of the Windows Azure Active Directory Module for Windows PoweShell – LINK

PowerShell commands

# Import MSOnline Module

Import-Module MSOnline

# Connect to Office 365

$O365Cred = Get-Credential
Connect-MsolService -Credential $O365Cred

# Show Licenses

Get-MsolAccountSku

# View details about the Services that are available in all of your license plans

Get-MsolAccountSku | Select -ExpandProperty ServiceStatus

# Check which users have licenses

Get-MsolUser -All | fl DisplayName, UsageLocation,isLicensed,Licenses

# Check if a user has a license – Single

Get-MsolUser -UserPrincipalName "user.name@domain.com" | ft DisplayName, UsageLocation,isLicensed,Licenses

# Add a license – Single user

Set-MsolUserLicense -UserPrincipalName "user.name@domain.com" -AddLicenses "company:ENTERPRISEPACK"

# Remove a license – Single user

Set-MsolUserLicense -UserPrincipalName "user.name@domain.com" –RemoveLicenses "company:ENTERPRISEPACK"

# Bulk Add licenses

$Users = Import-Csv -Path "C:\Temp\licenses.csv"
foreach ($User in $Users)
{
    $UPN = $User.‘SamAccountName’ + "@zhgplc.com"
    Set-MsolUser -UserPrincipalName "$UPN" -UsageLocation "GB"
    Set-MsolUserLicense -UserPrincipalName "$UPN" -AddLicenses "company:ENTERPRISEPACK"
}

# Bulk check added licenses 

$Users = Import-Csv -Path "C:\Temp\licenses.csv"
foreach ($User in $Users)

{
    $UPN = $User.‘SamAccountName’ + "@zhgplc.com"
    Get-MsolUser -UserPrincipalName "$UPN" | ft DisplayName, UsageLocation, Licenses
}

 

-Eric

Office 365 Excel Currency Issue

March 13, 2016 Leave a comment

Here’s how you can change the currency from $ to £ in the web version, without using the desktop program.

  1. Log in to Office 365
  2. Select Sites from the main menu (located at the very top left of the corner, mini tiles)
  3. Click the Settings menu (cog icon, located top right corner of the screen) and select Site settings
  4. Click on Regional Settings (under Site Administration category)
  5. Change the Region locale to English (United Kingdom). (Don’t forget to change your Time zone to UTC Dublin, Edinburgh, Lisbon, London.
  6. Click OK (located at the right corner, bottom of the page)
    I found this from Microsoft Support forums.

-Eric

Categories: Office 365 Tags:

Recover deleted emails on Exchange Online / Office 365

March 6, 2016 Leave a comment

I have separated this into multiple steps.

  1. Create a session to Exchange Online
  2. Find the users mailbox and locate the deleted emails
  3. Move the deleted emails to the users mailbox
  4. Permissions to do steps 2 and 3

 

  1. Create a session to Exchange Online
    • Enter User Credentials

      $Office365Cred = Get-Credential

    • Create the session

      $Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ `
      -Credential $Office365Cred -Authentication Basic –AllowRedirection

    • Import the session

      Import-PSSession $Session

  2. Find the users mailbox and locate the deleted emails

    • Find the users mailbox from the list, skip if you know the user

      Get-Mailbox

    • Look for deleted emails

      Search-Mailbox “Charlotte Smith” -SearchQuery “to:’Martyn Dawson'” -TargetMailbox “Discovery Search Mailbox” -TargetFolder “Charlotte Smith Recovery” -LogLevel Full

      TIP!If the Search-Mailbox command is not available (you will get an error)  you are missing Discovery Management role. Go to Step 4

  3. Move the deleted emails to the users mailbox
    • Recover deleted emails

      Search-Mailbox “Discovery Search Mailbox” -SearchQuery “to:’Martyn Dawson'” -TargetMailbox “Charlotte Smith” -TargetFolder “Recovered Messages” -LogLevel Full -DeleteContent

      TIP! – If the command gives you the error below you are missing Mailbox Import Export role. Go to Step 4
      A parameter cannot be found that matches parameter name ‘DeleteContent’.
      + CategoryInfo          : InvalidArgument: (:) [Search-Mailbox], ParameterBindingException
      + FullyQualifiedErrorId : NamedParameterNotFound,Search-Mailbox
      + PSComputerName        : outlook.office365.com

  4. Permissions to do steps 2 and 3.
    • Use the command below to give your admin account the missing “Discovery Management” Role permissions

      Add-RoleGroupMember -Identity “Discovery Management” -Member email.address@mail.com

    • Check your admin accounts membership

      Get-RoleGroupMember -Identity “Discovery Management”

    • Use the command below to give your admin account the missing “Mailbox Import Export” Role permissions
      Create a new Role Group

      New-RoleGroup “Mailbox Import-Export Management” -Roles “Mailbox Import Export”

    • Give Permissions to your admin user

      Add-RoleGroupMember “Mailbox Import-Export Management” -Member email.address@mail.com

    • Check your admin accounts membership

      Get-RoleGroupMember -Identity “Mailbox Import-Export Management”

      TIP! – You need to restart the session after adding the permissions.

-Eric

 

Directory Server (DirSync) Sync Commands for Manual Sync

March 2, 2016 Leave a comment

Usually DirSync runs every 2 hours. Here are the commands to run the sync manually when needed.

Import-Module DirSync
Start-OnlineCoexistenceSync –FullSync

These Commands can be used either straight on the server or connect to the server via PowerShell (ISE) using New Remote PowerShell Tab.

-Eric

How to Enable Remote Archiving Using Exchange Management Shell

May 7, 2015 Leave a comment

PowerShell (EMS) command to enable remote archiving after the mailbox has been migrated to Office 365.
Run the following command on your On-premises Exchange 2010 or Exchange 2013 server.

Command:
Enable-RemoteMailbox  -Identity MailboxName –Archive
Example:
Enable-RemoteMailbox  -Identity John.Smith –Archive

 

-Eric