##Connect to MSOnline
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope LocalMachine -Force;
Install-PackageProvider -Name NuGet -Force;
Set-PSRepository -Name "PSGallery" -InstallationPolicy Trusted;
Install-Module -Name MSOnline;
Connect-MsolService;
#Get licenses status
Get-MsolSubscription | Select-Object SkuPartNumber,Status,TotalLicenses,DateCreated,NextLifeCycleDate | Sort Name | Out-GridView;
#End
5/5 - (1 vote)