Who has an ATP License assignment in your tenant and who does not?

I have developed a script to check for who has a ATP license assigned and who does not in your tenant.


What you will need to do is connect PowerShell to O365  and run the following.


O365 PowerShell connection information:


  1. Start-transcript

  2. $PIUsers = Get-MsolUser -All | Where { ($_.isLicensed -eq $True) } | Select UserPrincipalName,Licenses

  3. ForEach ($User in $PIUsers) { ForEach ($License in $User.Licenses) { ForEach ($Service in $License.ServiceStatus) { If ($Service.ServicePlan.ServiceName -like 'ATP_ENTERPRISE') { $User.UserPrincipalName}}}}


  1. Stop-Transcript


Once completed the users that have the license assigned will be displayed in the output on screen and the transcript will output the results to a text file.