Forum Discussion

Byrdwatcher's avatar
Byrdwatcher
Copper Contributor
Jul 31, 2019
Solved

License overview, same email domain but want to seperate users in terms of location

Hi, 

 

I've a customer with many locations who have one email domain and would like an overview of their E3 Licences. Unfortunately they don't have their office or company field filled out in O365/Azure. Is there any way I can get an overview of their licences per location without having these fields filled out? 

 

I ran the following in PS but unfortunately there is no company of office information available: 


$lines = @()
foreach($msolUser in (Get-MSOLUser -All | where {$_.islicensed-eq $true} | where {$($_.licenses).accountskuid -eq 'volks:ENTERPRISEPACK'} ))
{
$UserInfo = Get-User -Identity $msolUser.UserPrincipalName
foreach($license in $msolUser.Licenses)
{
$lines += New-Object PsObject -Property @{
"Department"="$($UserInfo.Department)";
"UPN"="$($UserInfo.userprincipalname)";
"Username"="$($UserInfo.DisplayName)";
"Company"="$($UserInfo.Company)";
"Office"="$($UserInfo.Office)";
"AccountSKUID"="$($license.AccountSKUid)"
}
}
}
$lines | Export-CSV C:\temp\licences.csv –noType -Encoding:UTF8 -Delimiter ";"

 

Thanks for any help

  • You can always make up the location? 🙂 If the relevant data is not populated, there's not much you can do. You can try using some of the other attributes, such as CountryOrRegion or UsageLocation. Or if you feel adventurous, you can crawl the Azure AD sign-in logs for each user and use the geo-location data therein.

  • You can always make up the location? 🙂 If the relevant data is not populated, there's not much you can do. You can try using some of the other attributes, such as CountryOrRegion or UsageLocation. Or if you feel adventurous, you can crawl the Azure AD sign-in logs for each user and use the geo-location data therein.

Resources