Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources
Viewing all articles
Browse latest Browse all 6937

Error with foreach

$
0
0

I have a problem with this little script

$adress = Get-Content C:\temp\kons.txt
ForEach-Object {
$adressto = "$adress@adress.local"
get-aduser -Filter {mail -like $adressto}}

When i have one name in C:\temp\kons.txt it works

$adress will be user1@adress.local

When i have 2 names in it dont work

$adress will be user1 user2@adress.local

Can anyone see the error ?


Viewing all articles
Browse latest Browse all 6937

Trending Articles