Share via

Powershell syntax for ... expansion

stay puft 226 Reputation points
2022-12-14T19:39:18.63+00:00

get-aduser -Identity USERID -prop * |select * |fl

this is returning everything I want, except that there a bunch of properties that end with ...}

What is the proper syntax to have it return ALL the values?

Windows for business | Windows Server | User experience | PowerShell
0 comments No comments

Answer accepted by question author

  1. Rich Matheisen 48,116 Reputation points
    2022-12-15T03:33:20.217+00:00

    If you're going to post code, use the "Code Sample" editor. It's the 5th icon from the left in the Format Bar, and the icon is a graphic "101 010". If you use the "normal" editor it does strange and (not so) wonderful things to the data. Characters and certain character sequences are altered, comments become "bolded" text and use a larger font size, etc. For example, your code should appear like this:

    get-aduser -Identity USERID -prop * | select | fl *  
    

    The Format-List command doesn't usually truncate single-valued properties like strings. What I think you're referring to is that not all values in an enumeration are listed. The number of items from an enumeration are, by default, limited to the first four. You can change that limit by setting the value of the $FormatEnumerationLimit variable.

    This, for example, will list only the 1st four elements of the array named "Array". The 300 characters of the string named "Data" will be displayed in its entirety:

    [PSCustomObject]@{  
        X = "?"  
        Data = ("*" * 300)  
        Array = [array](1..100)  
    }| fl  
    

    To have Format-List show the first 8 elements of the array, add $FormatEnumerationLimit = 8 before the 1st line.

    For a longer explanation, see this: how-to-use-formatenumerationlimit

    Was this answer helpful?

    0 comments No comments

3 additional answers

Sort by: Most helpful
  1. stay puft 226 Reputation points
    2022-12-15T21:31:38.943+00:00

    Dear sir, that was perfect :)
    And the info on the code snippet was awesome as well, always wondered why that was there. TY so much!

    Was this answer helpful?

    0 comments No comments

  2. stay puft 226 Reputation points
    2022-12-15T00:43:26.257+00:00

    Not sure why the paste did not work correctly, there is an * in the command already. The FL did not expand the ...}

    so the command that is still not working is
    get-aduser -Identity USERID -prop * | select * | fl

    (sorry about the confusion)

    Was this answer helpful?


  3. Rich Matheisen 48,116 Reputation points
    2022-12-14T20:36:10.19+00:00

    Add an asterisk after the -Properties parameter to return all properties for an object returned by the cmdlet.

    The Format-List cmdlet has a default format the limits the length of the line to the width of the screen.

    Was this answer helpful?

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.