How to add a string to a variable

Alex
Alex used Ask the Experts™
on
Afternoon

I need to know how to add a string after a variable...

$Name = "$User.server-IWS-SVC"

Basically, I need it to say "Servername-iws-svc", the server name is pulled from a csv.

Thanks
Alex
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Most Valuable Expert 2018
Distinguished Expert 2018
Commented:
Easiest with a subexpression, assuming you're trying to access $User.Server:
$Name = "$($User.server)-IWS-SVC"

Open in new window

Or the good old way:
$Name = $User.server + "-IWS-SVC"

Open in new window

AlexSenior Infrastructure Analyst

Author

Commented:
The new way is what I was looking for, thank you as always

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial