Hi All,
I have the following code as part of a larger script;
$OddEvenCheck = $ENV:COMPUTERNAME.Substring($ENV:COMPUTERNAME.Length - 1) $OddEvenCheck = if ($OddEvenCheck % 2 -eq 0 ) {"even"} Elseif ($OddEvenCheck % 2 -eq 1 ) {"odd"}
The script, in its whole form, is designed to have a list of gateways as variables. It then runs as a startup script and detect the gateway and hostname of the local computer.
If the computers hostname ends with an odd numeric value and belongs to gateways from site 1 variable then it adds network printer connections from the print server 1.
If the computer hostname ends with an even numeric value and belongs to gateways from site 1 variable then it adds network printer connections from the print server 2.
etc etc.
What I can't quite figure out is how to trap the scenario whereby a computers hostnamedoesn't end with a numeric. Any advice would be greatly appreciated!
Adam