Hi,
I have tried the following commands to try and get a report from O365 which will give me the User account details with the UPN and the licensing information for that user, today I run 2 commands,
outlined below, each command works within their own right, however the only common link between the 2 command outputs is the Display Name, which is not unique within the tenant so I get duplicates, Is it possible to pull this information using one script?:
-
Get-Recipient -ResultSize Unlimited | Select DisplayName,UserPrincipleName,RecipientTypeDetails,WhenMailboxCreated,UsageLocation,CustomAttribute1,CustomAttribute2,CustomAttribute3,CustomAttribute4,PrimarySMTPAddress
| export-csv -path "c:\Temp\All Recipients.csv"
This script returns the details that I need (DisplayName,WhenMailboxCreated,UsageLocation,CustomAttribute1,CustomAttribute2,CustomAttribute3,CustomAttribute4,PrimarySMTPAddress >>)
but does not return the Users UPN or the licensing information.
-
To get the licensing information I run the following:
Get-MSOLUser -All | select DisplayName,userprincipalname,WhenMailboxCreated,UsageLocation,CustomAttribute1,CustomAttribute2,CustomAttribute3,CustomAttribute4,PrimarySMTPAddressislicensed,
{$_.Licenses.AccountSkuId}| Export-CSV c:\Temp\userlist.csv
This Returns only - DisplayName,userprincipalname,UsageLocation,{$_.Licenses.AccountSkuId}
-
I then do a VLOOKUP on the results, but the only common field that I have is the Display name which is not unique
Any help is appreciated
Thanks
Ken