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.

How To Use banid

  1. Enable the developer console in Counter-Strike settings.
  2. Open the console with the tilde key (~).
  3. Enter banid [Minutes] [User ID], replacing bracketed arguments with the value you want, then press Enter.

This legacy command is not currently listed as compatible with Counter-Strike 2.

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.