The Get-MgUserLicenseDetail cmdlet in Microsoft Graph PowerShell retrieves license details for a specific user in Microsoft 365. It provides information about assigned licenses and service plans, enabling administrators to understand a user’s subscription entitlements.
This cmdlet is highly useful for automation and reporting. IT admins can:
By using Get-MgUserLicenseDetail, organizations can streamline license tracking and ensure efficient subscription management.
Before running the cmdlet, ensure you have the Microsoft Graph PowerShell module installed and required permissions granted.
Install-Module Microsoft.Graph -Scope CurrentUser
Connect-MgGraph -Scopes "User.Read.All"
Basic syntax:
Get-MgUserLicenseDetail -UserId <GUID>
You can pass a User Principal Name (UPN) or User ID to fetch license details for a specific user.
Get-MgUserLicenseDetail -UserId samadmin@7xh7fj.onmicrosoft.com
Get-MgUserLicenseDetail -UserId "samadmin@7xh7fj.onmicrosoft.com" | Format-List
$users = @("kimmy@7xh7fj.onmicrosoft.com","samadmin@7xh7fj.onmicrosoft.com","LeeG@7xh7fj.onmicrosoft.com")
foreach($user in $users) {
Get-MgUserLicenseDetail -UserId $user
}
$users = Get-MgUser -All
foreach($user in $users) {
Get-MgUserLicenseDetail -UserId $user.Id | Export-Csv -Path "d:/WeekyUserLicenseDetails.csv" -NoTypeInformation -Append
}
Did You Know? Managing Microsoft 365 applications is even easier with automation. Try our Graph PowerShell scripts to automate tasks like generating reports, cleaning up inactive Teams, or assigning licenses efficiently.
Ready to get the most out of Microsoft 365 tools? Explore our free Microsoft 365 administration tools to simplify your administrative tasks and boost productivity.
© Your Site Name. All Rights Reserved. Design by HTML Codex