Author Posts

October 3, 2016 at 3:25 pm

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 🙂

Thanks,
Scott

October 3, 2016 at 3:34 pm

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

October 3, 2016 at 3:35 pm

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"}}

October 3, 2016 at 3:38 pm

Perfect! I knew it was something simple.

Thanks for not making me feel stupid...lol