How to kick users from Windows Server 2012 R2

domain-controllermaintenanceuserswindows-server-2012-r2

I need to migrate some databases from one server to another to decommission the first one. This server is sharing a network share and a database. Prior to migration and to ensure data integrity, I need to avoid users connections to DB as well as network resources. How can I kick all users connections (and keep them disconnected) but administrator ones?.

Both servers are now DC in case this is important.

Best Answer

  1. You can prevent new user connection using firewall(do not forget to leave an exception for administrator).
  2. Than you can close RDP sessions using logoff or tskill commands
  3. Than you can close opened smb sessions using net session \\<computer> /delete