NB! It seems this console command is not compatible with CS2.
Command Profile

BANID

CS:GO

This command will ban the user with the specified ID from the server, and add them to the banlist so that they cannot reconnect. The user ID of a user can be obtained by typing status into the console: the user ID is first number before a player's name in the list of players that is printed by that command.

Syntax
banid [Minutes] [User ID]

Description

This command will ban the user with the specified ID from the server, and add them to the banlist so that they cannot reconnect. The user ID of a user can be obtained by typing status into the console: the user ID is first number before a player's name in the list of players that is printed by that command.

Syntax And Arguments

banid [Minutes] [User ID]
Minutes The number of minutes you want to ban the user for. Use the value 0 to permanently ban them.
User ID The user ID of the person you want to ban from the server. Find the ID of a user by typing "status" into the console. The ID is the first number before a player's name in the list of players.