SOLVED

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

%3CLINGO-SUB%20id%3D%22lingo-sub-781076%22%20slang%3D%22en-US%22%3ELicense%20overview%2C%20same%20email%20domain%20but%20want%20to%20seperate%20users%20in%20terms%20of%20location%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-781076%22%20slang%3D%22en-US%22%3E%3CP%3EHi%2C%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI've%20a%20customer%20with%20many%20locations%20who%20have%20one%20email%20domain%20and%20would%20like%20an%20overview%20of%20their%20E3%20Licences.%20Unfortunately%20they%20don't%20have%20their%20office%20or%20company%20field%20filled%20out%20in%20O365%2FAzure.%20Is%20there%20any%20way%20I%20can%20get%20an%20overview%20of%20their%20licences%20per%20location%20without%20having%20these%20fields%20filled%20out%3F%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20ran%20the%20following%20in%20PS%20but%20unfortunately%20there%20is%20no%20company%20of%20office%20information%20available%3A%26nbsp%3B%3C%2FP%3E%3CP%3E%3CBR%20%2F%3E%24lines%20%3D%20%40()%3CBR%20%2F%3Eforeach(%24msolUser%20in%20(Get-MSOLUser%20-All%20%7C%20where%20%7B%24_.islicensed-eq%20%24true%7D%20%7C%20where%20%7B%24(%24_.licenses).accountskuid%20-eq%20'volks%3AENTERPRISEPACK'%7D%20))%3CBR%20%2F%3E%7B%3CBR%20%2F%3E%24UserInfo%20%3D%20Get-User%20-Identity%20%24msolUser.UserPrincipalName%3CBR%20%2F%3Eforeach(%24license%20in%20%24msolUser.Licenses)%3CBR%20%2F%3E%7B%3CBR%20%2F%3E%24lines%20%2B%3D%20New-Object%20PsObject%20-Property%20%40%7B%3CBR%20%2F%3E%22Department%22%3D%22%24(%24UserInfo.Department)%22%3B%3CBR%20%2F%3E%22UPN%22%3D%22%24(%24UserInfo.userprincipalname)%22%3B%3CBR%20%2F%3E%22Username%22%3D%22%24(%24UserInfo.DisplayName)%22%3B%3CBR%20%2F%3E%22Company%22%3D%22%24(%24UserInfo.Company)%22%3B%3CBR%20%2F%3E%22Office%22%3D%22%24(%24UserInfo.Office)%22%3B%3CBR%20%2F%3E%22AccountSKUID%22%3D%22%24(%24license.AccountSKUid)%22%3CBR%20%2F%3E%7D%3CBR%20%2F%3E%7D%3CBR%20%2F%3E%7D%3CBR%20%2F%3E%24lines%20%7C%20Export-CSV%20C%3A%5Ctemp%5Clicences.csv%20%E2%80%93noType%20-Encoding%3AUTF8%20-Delimiter%20%22%3B%22%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThanks%20for%20any%20help%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-781076%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EOffice%20365%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-782007%22%20slang%3D%22en-US%22%3ERe%3A%20License%20overview%2C%20same%20email%20domain%20but%20want%20to%20seperate%20users%20in%20terms%20of%20location%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-782007%22%20slang%3D%22en-US%22%3E%3CP%3EYou%20can%20always%20make%20up%20the%20location%3F%20%3A)If%20the%20relevant%20data%20is%20not%20populated%2C%20there's%20not%20much%20you%20can%20do.%20You%20can%20try%20using%20some%20of%20the%20other%20attributes%2C%20such%20as%20CountryOrRegion%20or%20UsageLocation.%20Or%20if%20you%20feel%20adventurous%2C%20you%20can%20crawl%20the%20Azure%20AD%20sign-in%20logs%20for%20each%20user%20and%20use%20the%20geo-location%20data%20therein.%3C%2FP%3E%3C%2FLINGO-BODY%3E
Highlighted
Occasional Contributor

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

1 Reply
Highlighted
Best Response confirmed by Byrdwatcher (Occasional Contributor)
Solution

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.