you could also set variables at registration stage in autoregister in the sense of if you know which OU a machine should go in by it’s naming convention (or by location if using location plugin) you could set it there and it gets set during registration then you never need to think about it and if it doesn’t match criteria revert back to defaultOU field… this potentially could be bundled into a simple plugin to hand OU … the limit really is endless (and i’m sure this code could be cleaned up a lot (Tom’d) and it’s quick and dirty but just so it’s simpler to follow…
for example:
if($_REQUEST['doad'] == '1') {
//Room/Location 1 Example Handler
$r1chk = strpos($realhost, 'R1-');
if ($r1chk !== false) {
$r1 = "1";
}
//Room/Location 2 Example Handler
$r2chk = strpos($realhost, 'R2-');
if ($r2chk !== false) {
$r2 = "1";
}
//Room/Location 3 Example Handler
$r3chk = strpos($realhost, 'R3-');
if ($r3chk !== false) {
$r3 = "1";
}
//Room/Location 4 Example Handler etc...etc...
$r4chk = strpos($realhost, 'R4-');
if ($r4chk !== false) {
$r4 = "1";
}
if ($reallocid == "10" && $r1 != "1" && $r2 != "1" && $r3 != "1" && $r4 != "1") {
$OUs = "OU=Location10,OU=Workstations,OU=Domain,DC=com";
} else if if ($reallocid == "15" && $r1 != "1" && $r2 != "1" && $r3 != "1" && $r4 != "1") {
$OUs = "OU=Location15,OU=Workstations,OU=Domain,DC=com";
} else if ($r1 == "1") {
$OUs = "OU=Room1,OU=Workstations,OU=Domain,DC=com";
} else if ($r2 == "1") {
$OUs = "OU=Room2,OU=Workstations,OU=Domain,DC=com";
} else if ($r3 == "1") {
$OUs = "OU=Room3,OU=Workstations,OU=Domain,DC=com";
} else if ($r4 == "1") {
$OUs = "OU=Room4,OU=Workstations,OU=Domain,DC=com";
} else {
$OUs = explode('|',$FOGCore->getSetting('FOG_AD_DEFAULT_OU'));
}