You could also do it as
Code:
on @+2:join:#ScriptTesting: .ban -k $chan $nick 2 <reason for kick/ban>


The @ symbol in front of the level means that the client running the code has to have full ops in the channel. On most IRC networks this is a requirement before allowing you to kick/ban other people.