Logoff

Applies To: Windows Server 2003, Windows Server 2003 R2, Windows Server 2003 with SP1, Windows Server 2003 with SP2

Logoff

Logs off a user from a session and deletes the session from the server.

Syntax

logoff[{SessionID | SessionName}] [/server:ServerName] [/v]

Parameters
  • SessionID
    Specifies the numeric ID which identifies the session to the server.
  • SessionName
    Specifies the name of the session.
  • /server: ServerName
    Specifies the terminal server containing the session whose user you want to log off. If unspecified, the server on which you are currently active is used.
  • /v
    Displays information about the actions being performed.
  • /?
    Displays help at the command prompt.
Remarks
  • You can always log off from the session to which you are currently logged on. You must, however, have Full Control permission to log off users from other sessions.

  • Logging off a user from a session without warning can result in loss of data at the user's session. You should send a message to the user by using the msg command to warn the user before taking this action.

  • If no ID or name for the session is specified, logoff logs off the user from the current session. If you specify a session name, it must be an active one.

  • When you log off a user, all processes end and the session is deleted from the server.

  • You cannot log off a user from the console session.

Examples

To log off a user from the current session, type:

logoff

To log off a user from a session using the session's ID, for example session 12, type:

logoff 12

To log off a user from a session using the name of the session and server, for example session TERM04 on server WF12, type:

logoff TERM04 /server:WF12

Formatting legend

Format Meaning

Italic

Information that the user must supply

Bold

Elements that the user must type exactly as shown

Ellipsis (...)

Parameter that can be repeated several times in a command line

Between brackets ([])

Optional items

Between braces ({}); choices separated by pipe (|). Example: {even|odd}

Set of choices from which the user must choose only one

Courier font

Code or program output

See Also

Concepts

Command-line reference A-Z
Command shell overview
Terminal Services commands