Convert array to string in Powershell

Example: Get-QADUser returns it’s ProxyAddresses attribute as an array. To convert that array to a string I use –join. By using either “, “ or “`n” as an argument I can make the string singleline or multiline for better reading.

get-qaduser -service cb.ds.mfcr.cz -Identity username -LdapFilter "(!(objectclass=inetOrgPerson))" | select name, @{n="proxy"; e={$_.ProxyAddresses -join "`n"}}  | fl *
Advertisements

Tagged: ,

One thought on “Convert array to string in Powershell

  1. Jason Sheets 29.1.2014 at 16:40 Reply

    Good Day 🙂 I have been looking for a solution to this problem for a while. Thank you for posting. I would like further information however. How would I use that now converted string? I need to be able to use that newly converted string to update an excel spreadsheet or be able to add it to a SharePoint list. How can this be achieved?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

smsagent

Tips, tricks and time-savers for the Windows and ConfigMgr administrator

To The Point

Anything about Technology and Business

Brian's Power Windows Blog

Microsoft in the Enterprise. Windows, Hyper-V, Exchange, SQL, and more!

PowerScripting Podcast

Shownotes and links for the PowerScripting Podcast, a podcast to help people learn Windows Powershell

Learn Powershell | Achieve More

What is this Powershell of which you speak?

%d bloggers like this: