Link to home
Start Free TrialLog in
Avatar of petaganayr
petaganayr

asked on

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!
ASKER CERTIFIED SOLUTION
Avatar of jmcg
jmcg
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of petaganayr
petaganayr

ASKER

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