txt file output formatting

I’m try to get output from query using get-aduser into a txt file with the following format.

usr3424 Kent, Clark usr3938 Wayne, Bruce usr54h65 Murdock, Matthew usr9495 Jordon, Hall usr4n7 Parker, Peter usr6080 Connell, Kenneth 

That is all the output txt file should contain, the format is the SAMAccountName, first column is fixed to 20 spaces and then the DisplayName, with no chars afterwards. No headers and just that data. I’ve tried several different ways and each one only give me a bit of what I want.

Tried just piping the output from the Get-Aduser and also putting it an array and sending it to a txt file with that but I can’t get the exact format I need

Any ideas on what I could look at? Thanks

submitted by /u/NewShoes4U
[link] [comments]

Leave a Reply