Share via


Net session

Manages server computer connections. Used without parameters, net session displays information about all sessions with the local computer.

Syntax

net session [\\ComputerName] [/delete]

Parameters

\\ ComputerName   : Identifies the computer for which you want to list or disconnect sessions.

/delete   : Ends the computer's session with ComputerName and closes all open files on the computer for the session. If you omit ComputerName, all sessions on the local computer are canceled.

net help   command   : Displays Help for the specified net command.

 Caution

  • Using net session can result in a loss of data. You might want to warn users before you disconnect a session.

Remarks

  • You can also use net sessions or net sess to run net session.

  • Use net session to view the computer names and user names of users on a server, to see if users have files open, and to see how long each user's session has been idle.

    The information appears in a format similar to the following:

    Computer      User name        Client type  Opens   Idle time
    

\BASSETT CHRISDR Windows 2000 1 00:00:13 \SHARONCA Administrator DOS LM 2.1 0 01:05:13

  • To display one user's session, use ComputerName with the command. The information about a single user includes a list of shared resources to which the user has connections.

  • A session is recorded when a user at a client successfully contacts a server. A successful session occurs when the two computers are on the same network, and the user has a user name and password that are accepted by the server. A user at a client has to have a session with a server before he or she can use the resources of the server, and a session is not established until a user at a client connects to a resource. A client and a server have only one session, but they can have many entry points, or connections, to resources.

  • To set how long a session can remain idle before being automatically disconnected, set the autodisconnect feature by using net config server /autodisconnect. For more information about net config server, see Related Topics. An automatic disconnection is transparent to the user because the session is automatically reconnected when the user accesses the resource again.

  • To end a session with the server, use net session **\\**ComputerName /delete.

Examples

To display a list of session information for the local server, type:

net session

To display session information for a client with the computer name Shepherd, type:

net session \\shepherd

To end all sessions between the server and the clients connected to it, type:

net session /delete

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

Net config

Net services overview

Command-line reference A-Z