on !@*:join:#channel1:{
if $nick ison #channel2 && $iil($chan,$nick).by {
.ban -k $chan $iil($chan,$nick).by Invited $nick who is on #channel2
}
}
This worked with my testing, but that may be due to the fact that I was testing it on a channel where I am the founder, so there is no one on the channel I can't kick/ban.
If you have Ops and the person that does the invite has admin or founder access, then you won't be able to kick/ban them.