locked
Get-MsolUser (-All) not showing all info RRS feed

  • General discussion

  • First of all, thanks for finally including the "WhenCreated" parameter for WAAD objects. But, there are some issues with the current implementation, it seems that if you use the Get-MsolUser cmdled without any parameters or with the "-All" parameter, the info is not populated:

    PS C:\> Get-MsolUser | ft Userp*,WhenCreated
    
    UserPrincipalName                                                                         WhenCreated
    -----------------                                                                         -----------
    vasil@michev.info
    sharednew@michev.info
    shared@michev.info
    asdfgh@michev.info
    blocked@michev.info
    huku@michev.info
    bathroom@michev.info
    Car1@michev.info
    SMO-13319KMRG@michev.info
    
    
    PS C:\> Get-MsolUser -UserPrincipalName vasil@michev.info | ft Userp*,WhenCreated
    
    UserPrincipalName                                                                         WhenCreated
    -----------------                                                                         -----------
    vasil@michev.info                                                                         19/10/2013 08:10:35
    
    
    PS C:\> Get-MsolUser -all | ft Userp*,WhenCreated
    
    UserPrincipalName                                                                         WhenCreated
    -----------------                                                                         -----------
    vasil@michev.info
    sharednew@michev.info
    shared@michev.info
    asdfgh@michev.info
    blocked@michev.info
    huku@michev.info
    bathroom@michev.info
    Car1@michev.info
    SMO-13319KMRG@michev.info
    So if we want to get the info, we need to loop over each user individually. Can we get someone to look at this?

    Tuesday, September 30, 2014 11:01 AM

All replies

  • I find that the cmdlet for outputting "WhenCreated" as a member of "Get-MSOLUser" doesn't render bulk output at all. This may be due to a bug in the WAAD module or may be by design by the Product Group. I coded a workaround, however, which inputs users individually and renders a bulk output for "WhenCreated" using a CSV file. Here are the instructions below:

    1st - Export all MSOL User UPNs to a csv file:

    Get-MSOLUser -All | Select UserPrincipalName | Export-CSV C:\Scripts\Users.csv

    2nd - Import the csv file and call each user's UPN individually to output bulk "WhenCreated" list:

    Import-CSV C:\Scripts\Users.csv | ForEach {Get-MSOLUser -UserPrincipalName $_.UserPrincipalName} | Select DisplayName, UserPrincipalName, WhenCreated

     
    Tuesday, December 16, 2014 8:43 PM
  • Works like a charm, that command did the trick!

    Thanks Andrew!

    Wednesday, December 17, 2014 3:52 PM
  • No need to export anything, you can easily get it by using calculated fields:

    Get-MsolUser -all | ft UserPrincipalName,DisplayName, @{n="WhenCreated";e={(Get-MsolUser -UserPrincipalName $_.UserPrincipalName).WhenCreated}}

    Question is why we have to do this in the first place :/

    Wednesday, December 17, 2014 4:55 PM
  • Even better! Great alternative! Thanks!
    Friday, December 19, 2014 5:31 PM