You may want to check if ADM is treated the same as adm in your script. Case sensativity may not be the only issue, with no EndIf's in the code, how does it know when or where to stop?