Using Powershell to show users in O365 who do not have an ATP license (question)

Copper Contributor

Hi All,

   

   We are trying to script a way to show users in Exchange Online who do not have an ATP license attached to them. 

 

I found this script: 

 

 

 

Get-MsolUser -All | Where-Object {$_.licenses -ne 'ATP_ENTERPRISE'} | Select-Object userprincipalname,licenses

 

 

 

However, I am trying to find a script that displays only users that do not have an ATP license so that we can quickly find them.  The above script displays all users and their licenses (including those that do not have an ATP license)

 

ATPPS.PNG

 

 

Thx

1 Reply

Hey @ColtA ,

 

Try this as per your screenshot:

 

Get-MsolUser -All | Where-Object {$_.licenses.AccountSkuId -ne 'reseller-account:ATP_ENTERPRISE'} | Select-Object userprincipalname,licenses

 

Thanks