Change logon command in Windows

The change logon command enables or disables login from client sessions or displaying the current login status. This utility is very useful for system maintenance.
  1. Applies to: Windows Server (Semi-Annual Channel), Windows Server 2016, Windows Server 2012 R2, Windows Server 2012.

The change logon command enables or disables login from client sessions or displaying the current login status. This utility is very useful for system maintenance. To find examples of how to use this command, please go to the Example below.

Note

In Windows Server 2008 R2, Terminal Services has been renamed to Remote Desktop Services.

Command syntax change logon

 change logon {/ query | / enable | / disable | / drain | / drainuntilrestart} 

Parameters

Description / query parameter Displays the current login status, whether enabled or disabled. / enable Allow logging in from the guest session, but not from the control panel. / disable Disable subsequent logins from guest sessions, but not from the control panel. Does not affect the user currently logged in. / drain Disable login from the new guest session but allow connection to the current session. / drainuntilrestart The login information is disabled from the new guest sessions until the computer restarts, but allows connecting to existing sessions. /? Show help at the command prompt.

Note

  1. Only the administrator can use the change logon command.
  2. Logins are reactivated when you restart the system. If you are connected to the Remote Desktop Session Host (rd Session Host) server from the guest session and disable login, then log out before activating the login again, you will not be able to reconnect to your session. . To re-enable logins from client sessions, log in to the console.

For example

To display the current login status, enter:

 change logon / query 

To enable login from guest sessions, enter:

 change logon / enable 

To disable login from the client, enter:

 change logon / disable 

See more:

  1. Change command in Windows
  2. Cd command in Windows
  3. The cacls command in Windows
4 ★ | 53 Vote