Quantcast
Channel: The Official Scripting Guys Forum! forum
Viewing all articles
Browse latest Browse all 15028

foreach vs foreach

$
0
0

i'm trying to update the msExchExtensionAttribute16 in AD and because I have a lot of users, I decided to write a script. however i'm stuck if the below will assign a value to msExchExtensionAttribute16 based on sAMAccountName (csv have employeeID and ipPhone only):

$userlist = import-csv C:\userlist.csv
foreach ($user in userlist)
{
x=get-aduser -LDAPfilter "(sAMAccountName=$user)"
set-aduser msExchExtensionAttribute16=$ipPhone
}

I just can't get or don't know how to tell the script that if sAMAccountName is equal to $employeeID then set msExchExtensionAttribute16=$ipPhone ?

Viewing all articles
Browse latest Browse all 15028

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>