I'm struggling to get a proper output, without any spaces and breaks. However, it automatically seems to add breaks and spaces. I'm using the code below.
Get-Content U:\Syn.txt | % {get-aduser -server blabla.com -f "proxyaddresses -like '*$_*'" -Properties userprincipalname,displayname,enabled,description,proxyaddresses,primarygroup} | fl userprincipalname, proxyaddresses, displayname, enabled, description, PrimaryGroup | out-file U:\output.txt
Below is the output (confidential data has been replaced with "xxxx") I get in return. Please pay attention to the "proxyaddresses" attribute, in which breaks and spaces can be found, due to its lengthy output. See the attachment for the resulted output I get.
userprincipalname : xxxx@xxx.com proxyaddresses : {x500:/o=ExchangeLabs/ou=Exchange Administrative Group (FYDIBOHF23SPDLT)/cn=Recipients/cn=3621dc31ee084f5a91fa8961a2c54033-HLD1LOD, X500:/o=BSH/ou=Exchange Administrative Group (FYDIBOHF23SPDLT)/cn=Recipients/cn=4b48b969c084441c94b2e75d7ebe53dd-xxxxxxxx, sip:xxxx@xxx.com, SMTP:xxxx@xxx.com} displayname : xxxx@xxx.com enabled : True description : xxxx xxxx PrimaryGroup : CN=Domain Users,CN=Users,DC=xxxx,DC=xxxx,DC=xxxx,DC=com
Requested Result: My intention is to receive an output without these breaks and spaces. is there an easy way without too much of a coding, that would help me to return an output without breaks and spaces in a single line?
Many thanks in advance for your support.