I'm running the below command and I need the output to be the usernames only. I can't seem to find a way to remove the beginning (1 blank line) and ending blank (2 blank lines) returns as well as the trailing spaces behind the usernames:
Get-ADGroupMember -identity "Domain Admins" | Select SAMAccountName | ft -hidetableheaders
I need to pass the usernames in an Orchestrator workflow, but I can't have any empty lines or extra spaces or my workflow will fail.
Any help is much appreciated.