Send the output to clipboard with a new line per group

Hello,

I use a script to add 1 or more users to 1 or more Adgroups.
At the end of this , I send the result to the clipboard .
The clipboard is then pasted into the ticket for the change quastion.

When I add the user the more than 1 ADgroup, I like to have every ADgroup on a new line.
Instead of writing all the ADgroups in one row.

What I have now:

$group = "rol-01-test,rol-02-com,rol23-wel-exc"
    
"The user is now member of the ADgroup(s) ): `n`n$($Group)" | % {$_.TrimStart()} | Set-Clipboard

Output:
De user is toegevoegd aan de Adgroep(en):

rol-01-test,rol-02-com,rol23-wel-exc

What I try to realise:
The user (username1) is now member of the Adgroup(s)
rol-01-test,
rol-02-com,
rol23-wel-exc

Thanx for your time and comment.

First you should make a proper array out of your string containing commas:

$group = 'rol-01-test','rol-02-com','rol23-wel-exc'

:wink:

Then you could create a string with all groups including the line breaks:

$GroupList = $($group.GetEnumerator()) | Out-String

And now you can use a here string to join the group list with your prosa output and send it to the clipboard:

@"
The user is now member of the ADgroup(s) ): 

$GroupList
"@ |
    Set-Clipboard

Thank you for the suggestions, it works for me
Learned someting new here today :pray: