NET.exe

The NET Command is used to manage File Shares, Printer Shares and sessions as follows:

Display a local share
NET SHARE sharename

Display a list of computers in the current domain.
NET VIEW

To see a list of shares on a remote computer
NET VIEW \\ComputerName

To see a list of all shares in the domain:
NET VIEW /DOMAIN

To see a list of shares on a different domain
NET VIEW /DOMAIN:domainname

To see a list of shares on a remote Netware computer
NET VIEW /NETWORK:NW [\\ComputerName]

Create a new local file share
NET SHARE sharename=drive:path /REMARK:"text" [/CACHE:Manual | Automatic | No ]

Limit the number of users who can connect to a share
NET SHARE sharename /USERS:number /REMARK:"text"

Remove any limit on the number of users who can connect to a share
NET SHARE sharename /UNLIMITED /REMARK:"text"

Delete a share
NET SHARE {sharename | devicename | drive:path} /DELETE

Delete all shares that apply to a given device
NET SHARE devicename /DELETE
In this case the devicename can be a printer (Lpt1) or a pathname (C:\Docs\)

Join a file share (Drive MAP)
NET USE

Display all the open shared files on a server and the lock-id
NET FILE

Close a shared file (disconnect other users and remove file locks)
NET FILE id /CLOSE

List all sessions connected to this machine
NET SESSION

List sessions from a given machine
NET SESSION \\ComputerName

Disconnect all sessions connected to this machine
NET SESSION /DELETE

Disconnect all sessions connected to this machine (without any prompts)
NET SESSION /DELETE /y

Disconnect sessions from a given machine
NET SESSION \\ComputerName /DELETE

Notes:
NET SESSION displays incoming connections only, in other words it must be run on the machine that is acting as the server.

To create file shares the SERVER service must be running, which in turn requires 'File and Print Sharing' to be installed.

“Don’t worry about people stealing an idea. If it's original, you will have to ram it down their throats” - Howard Aiken

Related:

NET - Manage network resources
NET USE - connect to a file share
OPENFILES - List or disconnect open files, local or remote (Win XP)
PsFile - Show files opened remotely
PsLoggedOn - Who's logged on
fsmgmt.msc - List or disconnect open files - (Win XP GUI)
Drmapsrv - Drive Share for use with Terminal Services (Win 2K Server Resource Kit only)
Q149427 - Change Password from the CMD prompt
Slow Network Browsing (XP)
Powershell: Get-WmiObject win32_share
Equivalent bash command (Linux): users - Users currently logged in, who currently logged in


© Copyright SS64.com 1999-2014
Some rights reserved