
O365 – Tips & Tricks in Powershell
Hello,
For those who are starting to work on O365 using powershell, here below are some short lines to help you.
Prerequisites :
https://technet.microsoft.com/en-us/library/dn975125.aspx
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