O365 – Tips & Tricks in Powershell


For those who are starting to work on O365 using powershell, here below are some short lines to help you.

Prerequisites :


Connect to O365 :

$cred=get-credential -Message "Please provide an O365 admin account"
connect-msolservice -credential $cred
$O365Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://ps.outlook.com/powershell -Credential $cred -Authentication Basic -AllowRedirection
Import-PSSession $O365Session -AllowClobber

Add a licence to a user :

$Options = New-MsolLicenseOptions –AccountSkuId "YOURTENANT:ENTERPRISEPACK"
 Set-MsolUserLicense –UserPrincipalName $upn –LicenseOptions $Options -ErrorVariable:errv



Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

How to whitelist website on AdBlocker?

How to whitelist website on AdBlocker?

  1. 1 Click on the AdBlock Plus icon on the top right corner of your browser
  2. 2 Click on "Enabled on this site" from the AdBlock Plus option
  3. 3 Refresh the page and start browsing the site