Forum Discussion
d-rajapaksa
Oct 04, 2021MVP
Get list of inactive users with licenses assigned in Microsoft 365
I have a Microsoft 365 tenant with more than 1000 users in it. I need to get a list of users who have not been active for the last 180 days but are assigned with licenses. The goal is to check if use...
- Oct 04, 2021To be more precise you could:
1/ Get all the users with licenses assigned
The most simple solution is: Get-MsolUser -All | where {$_.isLicensed -eq $true}
To go further, I use several custom scripts :
- To get a list of the licenses assigned to a user (ex : Office 365 E3) : https://github.com/thijoubert/Sharing/blob/main/PowerShell/AAD_Licenses_Users.ps1
- To get a full list of the SKU assigned to a user (ex : SharePoint Online P2) : https://github.com/thijoubert/Sharing/blob/main/PowerShell/AAD_Licenses_Users_Details.ps1
2/ Get the last sign-in date for you users:
The most simple solution : https://docs.microsoft.com/en-us/azure/active-directory/reports-monitoring/howto-manage-inactive-user-accounts
You could use Graph explorer with an admin account
3/ Cross-reference the two lists to get your answer
d-rajapaksa
Oct 04, 2021MVP
Thanks, but this does not have a way to get users with licenses assigned
thijoubertold
Oct 04, 2021Iron Contributor
To be more precise you could:
1/ Get all the users with licenses assigned
The most simple solution is: Get-MsolUser -All | where {$_.isLicensed -eq $true}
To go further, I use several custom scripts :
- To get a list of the licenses assigned to a user (ex : Office 365 E3) : https://github.com/thijoubert/Sharing/blob/main/PowerShell/AAD_Licenses_Users.ps1
- To get a full list of the SKU assigned to a user (ex : SharePoint Online P2) : https://github.com/thijoubert/Sharing/blob/main/PowerShell/AAD_Licenses_Users_Details.ps1
2/ Get the last sign-in date for you users:
The most simple solution : https://docs.microsoft.com/en-us/azure/active-directory/reports-monitoring/howto-manage-inactive-user-accounts
You could use Graph explorer with an admin account
3/ Cross-reference the two lists to get your answer
1/ Get all the users with licenses assigned
The most simple solution is: Get-MsolUser -All | where {$_.isLicensed -eq $true}
To go further, I use several custom scripts :
- To get a list of the licenses assigned to a user (ex : Office 365 E3) : https://github.com/thijoubert/Sharing/blob/main/PowerShell/AAD_Licenses_Users.ps1
- To get a full list of the SKU assigned to a user (ex : SharePoint Online P2) : https://github.com/thijoubert/Sharing/blob/main/PowerShell/AAD_Licenses_Users_Details.ps1
2/ Get the last sign-in date for you users:
The most simple solution : https://docs.microsoft.com/en-us/azure/active-directory/reports-monitoring/howto-manage-inactive-user-accounts
You could use Graph explorer with an admin account
3/ Cross-reference the two lists to get your answer
- Maqsood Ali BhattiMay 03, 2024Copper Contributor
We solve same thing with pre-built Microsoft Access Review (inactivity of users) and target is a License Group. We are taking out data from Graph and enriching data with Org info right into JIRA for business decision.
- d-rajapaksaOct 05, 2021MVP
- thijoubertoldOct 05, 2021Iron ContributorDid you grant the relevant permissions?
- User.Read.All
- Directory.Read.All
- Auditlogs.Read.All- d-rajapaksaOct 05, 2021MVPIn the modify permission tab I cannot see the Auditlogs.Read.All... Where can I locate them?