So I am capturing an office name using read-host and storing it in the $office variable, then forcing it to uppercase. Then I am using that value to set the $OU variable. However, $office and $OU variables always end up being the last OU, like it isn’t seeing the If part.
$office = Read-Host "Enter office (NYC, SFO, or MIA)" $office = $office.ToUpper() If ($office = "NYC") {$OU="NYC OU"} If ($office = "SFO") {$OU ="SFO OU"} If ($office = "MIA") {$OU = "MIA OU"}
This seems like it would be pretty simple but obviously I am missing something.
submitted by /u/null_input
[link] [comments]
The post Setting variables based on read-host input and it’s not working. appeared first on How to Code .NET.