none
Office 365 Licensing and User information in one PowerShell command RRS feed

  • Question

  • 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?:

     

    1. 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.

     

    1. 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}

     

    1. 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

    • Moved by Bill_Stewart Wednesday, November 29, 2017 6:27 PM This is not "scripts on demand"
    Tuesday, October 10, 2017 1:12 PM

All replies