Adding to the expression

Really stupid question here that is best explained with an example:

get-aduser tuser| Select @{n=‘testname’;e={$_.samaccountname}}

I want to add to the end of the samaccountname like:

get-aduser tuser| Select @{n=‘testname’;e={$_.samaccountname}“SOMETHINGELSE”}

I know it’s something simple but I just don’t know how to format it.

Just learning here :slight_smile:

Thanks,
Scott

@{n='testname';e={"$($_.samaccountname)SOMETHINGELSE"}}

The part inside the {} will evaluate any code and return the results, so you can use any method for creating and joining strings. One example:

@{n='testname';e={"$($_.samaccountname)SOMETHINGELSE"}}

Perfect! I knew it was something simple.

Thanks for not making me feel stupid…lol