I do not believe that ban can be run from a command block as it does not actually run the command via chat. None of these commands work through command blocks:
ban, ban-ip, deop, kick, op, pardon, pardon-ip, save-all, save-off, save-on, stop, whitelist add/remove/on/off/reload, debug, publish, kill. help, seed, list, scoreboard objectives/players/teams, list, banlist, whitelist list https://minecraft.gamepedia.com/Command_Block