Need help with a powershell script

I need help with writing a powershell script line.

$Userlist = Import-Csv "C:\userimport.csv"

ForEach ($Person in $Userlist) {
$Person.userName

$url="http://mywordpresssite.org/?users=$Person.userName&secret=123supersecretkey456"
(New-Object System.Net.WebClient).DownloadString("$url");

}

Open in new window


I do not know how to pass the value of $Person.userName so the $url would look like this:
$url="http://mywordpresssite.org/?users=userA&secret=123supersecretkey456"

I've tried a few things but none of them are working.

Thank you!
LVL 2
petaganayrAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

jmcgOwnerCommented:
The first thing users try when they realize variable expansion in strings has some limitations is to use a temporary variable:

$tempname = $Person.userName

$url="http://mywordpresssite.org/?users=$tempname&secret=123supersecretkey456"

Open in new window


A little later, they may see subexpressions being used and prefer to do it that way:

$url="http://mywordpresssite.org/?users=$($Person.userName)&secret=123supersecretkey456"

Open in new window


But perhaps you've already tried these ideas and something else is going wrong?
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
petaganayrAuthor Commented:
jmcg,

Thank you. yes, I've tried both earlier. And, I found out why none of them work. Writer error, I will curl up under a rock now.

Thank you! :D
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Powershell

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.