question

elisorow-6970 avatar image
0 Votes"
elisorow-6970 asked azure-cxp-api edited

Get-AzureADUser Company Name

Hi all,
in order to have an aduser list sorted by company name, i tried
Get-AzureADUser -All $true | select UserPrincipalName -ExpandProperty CompanyName
Get-AzureADUser -All $true | Select-Object -Property CompanyName

both commands give only a list of the companies

Get-AzureADUser -All $true | select UserPrincipalName alone gives the list of ad users
and with the -ExpandProperty CompanyName we have only the list of the companies without the users

any idea how to display both UPN and company name ?

it seems simple but honestly after several hours and hundreds of powershell commands (true, true) i didn t figure it out .

sincere thanks for any help

regards

azure-ad-user-management
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

MatteoSircana avatar image
0 Votes"
MatteoSircana answered

Hi @elisorow-6970,

you can try this:

Get-AzureADUser -All $true | Select-Object -Property CompanyName, UserPrincipalName

After the -Property parameter you can add the properties to show separated by comma.

Then at the command end you can add | Sort-Object -Property CompanyName to sort by CompanyName

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

elisorow-6970 avatar image
0 Votes"
elisorow-6970 answered SaurabhSharma-msft commented

Hi @MatteoSircana

it was so close but still so far !
thank you so much,

any idea to add "Select -ExpandProperty AssignedLicenses in this ps command

the goal is to have a list of the AD users with company name and licensetype assigned.

thanks again for ur help.
Eli

· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

@elisorow-6970 Just checking in if you are able to achieve your desired results ?

1 Vote 1 ·