Forum Discussion

Patrick Rote's avatar
Patrick Rote
Iron Contributor
Nov 23, 2020

How to get createddatetime,Assignedlicences using Get-AzureADUser from AzureAD

Hi All,
I would like to  get the following properties
-Createddatetime - time users was created
-Assigned Licences
I tried the following below

 

Get-AzureADUser -All $true | Where-Object {$_.mail -like '*@domain'} | Select-Object ObjectId, DisplayName, UserPrincipalName, JobTitle, StreetAddress, ImmutableId, Department, CompanyName, FacsimileTelephoneNumber, AccountEnabled, UserType, passwordPolicies, createdDateTime, @{N="Licenses";E={$_.Licenses.AccountSkuId}}	 | Export-Csv -nti  "outputfile"


But my createdDateTime retuned nothing  and AssignedLicences is returning a collection.
How can i get a list of the assignlicences and the createdatetime?

Thanks

 

5 Replies

  • farismalaeb's avatar
    farismalaeb
    Steel Contributor
    Hi,
    Did it work with you as in the answer I propose 🙂 ... hopefully

    if all is good, please Click on Best Response and hit the like button

    Thanks
    • Patrick Rote's avatar
      Patrick Rote
      Iron Contributor

      Thanks farismalaeb 
      Haven't tested MSOnline module as yet.
      Can i get users createdDatetime using PNP at all?
      Or its not possible?

      • farismalaeb's avatar
        farismalaeb
        Steel Contributor

        Patrick Rote 

        try it and let me know, but I am using the MSOnline module which give me almost all such details.

         

        keep me posted.

        Thanks

         

  • farismalaeb's avatar
    farismalaeb
    Steel Contributor

    Patrick Rote 

    Hi,

    based on my try I notice that the Get-AzureADUser dont have the CreateDateTime property.

    also for the licensing you will need to use Get-AzureADUserLicenseDetail | select Sku*,ServicePlans

    I am using Get-Msonline and its returning all the result you are looking for.

    So I can get the WhenCreate property and Licenses. I guess its better to use the MSOnline module.

     

    Both are connecting to the same AD.