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

Trying to use multiple if statements to set a variable in my script

$
0
0

I am importing a csv file to create user accounts.. i have it working.. but now i want to have the script look at a variable, and based on that variable set other variables, like the ou or home directory path etc..

here's what i have so far.. it seems to select the 2nd option ASH unless i # it out then it selects the first option..i am clearly missing something simple here.... i can't just use an else statement as i will need many lines of logic to support the many different ou's, home dir shares etc.. globally...

import-csv $csv | foreach-object {

                   

 $site=$_.site
                   $HomeDArl= "\\teleflex\global\home\medical\na\arl"
                   $HomeDASH= "\\ashfs01.arrowintl.com\user"

                        if ($site='ARL'){
                            $homed = $HomeDArl
                        }
                        if ($site='ASH'){
                            $homed =$HomeDASH 
                        } 

}



Viewing all articles
Browse latest Browse all 15028

Trending Articles



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