Hi.
I am working on a AD script to create a user, i am at a point where i am addding exchange groups. Below is just an example of the challenge. I got multiple countries, and based on different factors etc, department then they need to be added to certerin exchange groups. I am currently working with Switch and then IF, but i end up doing a lot of code copy-pasting.
Is there a smarter way to write such logic?
switch ($Country) {
US {
add user to "A" exchange groups
If (user department = sales then add user to "B" exchange groups
if (user department = Accounting then add user to "C" exchange groups
}
DK {
add user to "D" exchange groups
If (user department = sales then add user to "E" exchange groups
if (user department = Accounting then add user to "F" exchange groups
}
DE {
and so on ...
}
GB {
and on...
}
NL {
.....
}
IT {
}
FR {
}
AT {
}
CH {
}
PH {
}