Get all user lisences from Office 365 to csv.

Hi, Today I had to get a list from Office 365 with UserPrincipalName and MsolAccountSku. So here is the trick-script. $ReportPath = "c:userlist.csv" Add-Content -value ("UserPrincipalName"+","+"IsLicensed"+","+ "Licenses”) -Path $ReportPath $AllUsers = Get-MsolUser -All foreach ($User in $AllUsers) {  $UserPrincipalName = $User.UserPrincipalName  $IsLicensed = $User.IsLicensed  $Licenses = $User.Licenses.AccountSkuId  Add-Content -value ($UserPrincipalName+","+$IsLicensed+","+$Licenses)…continue reading →