# Prompt the USER TO enter the username $username = Read-Host "Enter the username" # Get the USER object FROM Active DIRECTORY $user = Get-ADUser $username -Properties * # Get the licenses assigned TO the USER $licenses = Get-ADUser $user -Properties msDS-UserLicenses | Select-Object -ExpandProperty msDS-UserLicenses # Display the licenses Write-Host "Licenses assigned to $($user.Name):" $licenses