License Details from Office Admin Portal - Knowledgebase - CLOUDRAIN

License Details from Office Admin Portal Print

  • 0

# Install AzureAD.Standard.Preview module if you haven't already
# Install-Module -Name AzureAD.Standard.Preview

# Import the AzureAD.Standard.Preview module
Import-Module -Name AzureAD.Standard.Preview

# Authenticate to Azure AD
Connect-AzureAD

# Create a hashtable to map license GUIDs to friendly names
$licenseMapping = @{
"c5928f49-12ba-48f7-ada3-0d743a3601d5" = "VISIOCLIENT"
"1f2f344a-700d-42c9-9427-5cea1d5d7ba6" = "STREAM"
"6470687e-a428-4b7a-bef2-8a291ad947c9" = "WINDOWS_STORE"
"f30db892-07e9-47e9-837c-80727f46fd3d" = "Microsoft Power Automate Free"
"606b54a9-78d8-4298-ad8b-df6ef4481c80" = "CCIBOTS_PRIVPREV_VIRAL"
"cbdc14ab-d96c-4c30-b9f4-6ada7cdc1d46" = "Microsoft 365 Business Premium"
"dcb1a3ae-b33f-4487-846a-a640262fadf4" = "POWERAPPS_VIRAL"
"338148b6-1b11-4102-afb9-f92b6cdc0f8d" = "DYN365_ENTERPRISE_P1_IW"
"e0dfc8b9-9531-4ec8-94b4-9fec23b05fc8" = "Microsoft_Teams_Exploratory_Dept"
"f245ecc8-75af-4f8e-b61f-27d8114de5f3" = "Microsoft 365 Business Standard"
"a403ebcc-fae0-4ca2-8c8c-7a907fd6c235" = "POWER_BI_STANDARD"
"c2273bd0-dff7-4215-9ef5-2c7bcfb06425" = "OFFICESUBSCRIPTION"
"47794cd0-f0e5-45c5-9033-2eb6b5fc84e0" = "MCOPSTNC"
"3f9f06f5-3c31-472c-985f-62d9c10ec167" = "Power_Pages_vTrial_for_Makers"
"b30411f5-fea1-4a59-9ad9-3db7c7ead579" = "POWERAPPS_PER_USER"
"98defdf7-f6c1-44f5-a1f6-943b6764e7a5" = "Microsoft Defender For Identity"
"0c266dff-15dd-4b49-8397-2bb16070ed52" = "MCOMEETADV"
"3b555118-da6a-4418-894f-7df1e2096870" = "Microsoft 365 Business Basic"
"53818b1b-4a27-454b-8896-0dba576410e6" = "PROJECTPROFESSIONAL"
"eda1941c-3c4f-4995-b5eb-e85a42175ab9" = "POWERAUTOMATE_ATTENDED_RPA"
"19ec0d23-8335-4cbd-94ac-6050e30712fa" = "EXCHANGEENTERPRISE"

"8c4ce438-32a7-4ac5-91a6-e22ae08d9c8b" = "RIGHTSMANAGEMENT_ADHOC"
"5b631642-bd26-49fe-bd20-1daaa972ef80" = "POWERAPPS_DEV"

# Add more mappings as needed
}

# Get all users
$users = Get-AzureADUser -All $true

# Create an array to store user details
$userDetails = @()

# Iterate through each user
foreach ($user in $users) {
$assignedLicenses = foreach ($assignedLicense in $user.AssignedLicenses) {
$licenseName = $licenseMapping[$assignedLicense.SkuId]
if ($licenseName) {
$licenseName
} else {
$assignedLicense.SkuId
}
}

$userDetail = [PSCustomObject]@{
DisplayName = $user.DisplayName
UserPrincipalName = $user.UserPrincipalName
AssignedLicenses = $assignedLicenses -join ', '
}
$userDetails += $userDetail
}

# Export the user details to a CSV file
$userDetails | Export-Csv -Path "C:\User_Licenses_Details.csv" -NoTypeInformation


Was this answer helpful?

« Back

Powered by WHMCompleteSolution