The ban method suggested would be the easiest, but if a nick changes to Unknown*** after in the channel, he/she wouldn't be kicked. So you could still have the problem even if the user couldn't actually talk because of the ban.
If you want to still make the script, here are the topics you'd need:
/help while loops
/help $nick (select the second result)
-- Specifically, you'll want to look at $nick($chan,0) to get
the total nicks in the channel, then look through
$nick($chan,N) where N is a number from 1 to the total
number of nicks. This will let you check every nick for
"Unknown*". Note that you can limit the search using that
to only look at Regular users (or Regular and Voiced) as
you probably don't want to kick Ops. That would use
$nick($chan,0,r) or $nick($chan,0,rv) and then replace 0
with the N number like before.
/help if then else
You'd also need to know /mode and/or /ban and also /kick, but I assume you already know those.