Net session

Updated: April 17, 2012

Applies To: Windows 7, Windows 7 with SP1, Windows Server 2003, Windows Server 2003 R2, Windows Server 2003 with SP1, Windows Server 2003 with SP2, Windows Server 2008, Windows Server 2008 R2, Windows Server 2008 R2 with SP1, Windows Vista, Windows XP

Manages server computer connections.

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] [/list]

Parameters

Parameter Description

\\<ComputerName>

Identifies the client computer for which you want to list or disconnect sessions.

/delete

Ends the session with the specified client computer and closes all open files on the local computer for the session. If you omit \\<ComputerName>, all sessions on the local computer are canceled.

/list

Displays information in a list rather than a table.

Warning

  • 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
      ------------------------------------------------------------------------
      \\BWESTON       CHRISDR          Windows 7       1       00:00:13
      \\JAMESMC-01    Administrator    Windows Vista   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. 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. An automatic disconnection is transparent to the user, because the session is automatically reconnected when the user accesses the resource again.

    • To end a computer's 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 bweston, type:

    net session \\bweston

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

    net session /delete

    Additional References

    Command-Line Syntax Key