Recent from talks
Contribute something
Nothing was collected or created yet.
Net (command)
View on Wikipedia| net | |
|---|---|
The ReactOS net command | |
| Developers | Microsoft, IBM, ReactOS Contributors |
| Initial release | April 2, 1985 |
| Operating system | MS-Net, DOS, OS/2, Windows, ReactOS, eComStation, ArcaOS |
| Platform | Cross-platform |
| Type | Command |
| License | MS-Net, OS/2, Windows, eComStation, ArcaOS: Proprietary commercial software ReactOS: GNU General Public License |
| Website | docs |

net commandIn computing, net is a command in IBM OS/2 (including eComStation and ArcaOS), Microsoft Windows, and ReactOS used to manage and configure the operating system from the command-line. It is also part of the IBM PC Network Program for DOS.[1]
Overview
[edit]The command is primarily used to manage network resources.[2] It is an external command implemented as net.exe.[3] When used in a batch file, the /Y or /N switches can be used to unconditionally answer Yes or No to questions returned by the command.[2] The net command has several sub-commands that can differ from one implementation or operating system version to another.
On Windows CE .NET 4.2,[4] Windows CE 5.0[5] and Windows Embedded CE 6.0,[6] it is available as an external command stored in \Windows\net.exe. This version only supports the use and view sub-commands.
| Name | Description | DOS support | OS/2 support | Windows support | ReactOS support | Remarks |
|---|---|---|---|---|---|---|
| access | Manage access | No | IBM OS/2 LAN Server, OS/2 Warp 4.5[7] | No | No | |
| accounts | Change Netlogon service role and manage maximum user logon time, password expiration time and other account settings | No | IBM OS/2 LAN Server, OS/2 Warp 4.5[7] | Windows NT, Windows 2000, Windows XP, Windows Vista, Windows 7, Windows 8, Windows 10[8][3][9] | ReactOS 0.4.8[10] | |
| admin | Run administrative command on a remote server | No | IBM OS/2 LAN Server, OS/2 Warp 4.5[7] | No | No | |
| alias | Manage aliases currently defined in the domain | No | IBM OS/2 LAN Server, OS/2 Warp 4.5[7] | No | No | |
| app | Manage information about application definitions | No | IBM OS/2 LAN Server, OS/2 Warp 4.5[7] | No | No | |
| appparm | No | OS/2 Warp 4.5[7] | No | No | OS/2 Warp 4.5 and later only | |
| audit | List and clear contents of the network audit log of the server | No | IBM OS/2 LAN Server, OS/2 Warp 4.5[7] | No | No | |
| comm | List information about queues for shared serial devices | No | IBM OS/2 LAN Server, OS/2 Warp 4.5[7] | No | No | |
| computer | Add or delete computer from domain database | No | No | Windows Server 2000, Windows Server 2003, Windows Server 2003 with SP1, Windows Server 2003 R2, Windows Server 2008, Windows Server 2012, Windows NT, Windows 2000, Windows XP, Windows Vista, Windows 7, Windows 8, Windows 10[8][3][9][11][12] | ReactOS 0.4.8[13] | |
| config | Display NetBIOS configuration information | No | IBM OS/2 LAN Server, OS/2 Warp 4.5[7] | Windows 95, Windows 98, Windows NT, Windows 2000, Windows XP, Windows Vista, Windows 7, Windows 8, Windows 10[8][3][9] | ReactOS 0.4.8[14] | |
| continue | Continue paused services | IBM PC Network Program[1] | IBM OS/2 LAN Server, OS/2 Warp 4.5[7] | Windows NT, Windows 2000, Windows XP, Windows Vista, Windows 7, Windows 8, Windows 10[8][3][9] | ReactOS 0.4.8[15] | |
| copy | Copy and append files locally and remotely | No | IBM OS/2 LAN Server, OS/2 Warp 4.5[7] | No | No | |
| dasd | Manage and display directory limits | No | IBM OS/2 LAN Server, OS/2 Warp 4.5[7] | No | No | |
| device | List statuses of shared serial devices and stop current use of a device | No | IBM OS/2 LAN Server, OS/2 Warp 4.5[7] | No | No | |
| diag | Run the Microsoft Network Diagnostic program | No | No | Windows 95, Windows 98[8] | No | |
| error | List and clear network error log | IBM PC Network Program[1] | IBM OS/2 LAN Server, OS/2 Warp 4.5[7] | No | No | |
| file | List files opened by remote computers | IBM PC Network Program[1] | IBM OS/2 LAN Server, OS/2 Warp 4.5[7] | Windows NT, Windows 2000, Windows XP, Windows Vista, Windows 7, Windows 8, Windows 10[8][3][9] | Unimplemented[16] | |
| forward | Route incoming messages and cancel forwarding | IBM PC Network Program[1] | IBM OS/2 LAN Server, OS/2 Warp 4.5[7] | No | No | |
| group | Add, display, or modify global groups in domains | No | IBM OS/2 LAN Server, OS/2 Warp 4.5[7] | Windows Server 2000, Windows Server 2003, Windows Server 2003 with SP1, Windows Server 2003 R2, Windows Server 2008, Windows Server 2012, Windows NT, Windows 2000, Windows XP, Windows Vista, Windows 7, Windows 8, Windows 10[8][3][9][17][18] | ReactOS 0.4.8[19] | |
| help | Display syntax | No | IBM OS/2 LAN Server, OS/2 Warp 4.5[7] | Windows 95, Windows 98, Windows NT, Windows 2000, Windows XP, Windows Vista, Windows 7, Windows 8, Windows 10[8][3][9] | ReactOS 0.4.8[20] | |
| helpmsg | Display information on error messages | No | No | Windows NT, Windows 2000, Windows XP, Windows Vista, Windows 7, Windows 8, Windows 10[8][3][9] | ReactOS 0.4.8[21] | |
| init | No | No | Windows 95, Windows 98[8] | No | ||
| localgroup | Add, display, or modify local groups | No | No | Windows Server 2008, Windows Server 2012, Windows NT, Windows 2000, Windows XP, Windows Vista, Windows 7, Windows 8, Windows 10[8][3][9][22][23] | ReactOS 0.4.8[24] | |
| log | Start/stop saving messages to a file/printer and display information about forwarding the current message log | IBM PC Network Program[1] | IBM OS/2 LAN Server, OS/2 Warp 4.5[7] | No | No | |
| logoff | No | No | Windows 95, Windows 98[8] | No | ||
| logon | No | No | Windows 95, Windows 98[8] | No | ||
| move | Move files locally and remotely | No | IBM OS/2 LAN Server, OS/2 Warp 4.5[7] | No | No | |
| name | List or manage NetBIOS names | IBM PC Network Program[1] | IBM OS/2 LAN Server, OS/2 Warp 4.5[7] | Windows NT, Windows 2000, Windows XP[8][9] | Unimplemented[16] | |
| password | Change passwords on a server or in a domain | No | IBM OS/2 LAN Server, OS/2 Warp 4.5[7] | Windows 95, Windows 98[8] | No | |
| pause | Pause services | IBM PC Network Program[1] | IBM OS/2 LAN Server, OS/2 Warp 4.5[7] | Windows NT, Windows 2000, Windows XP, Windows Vista, Windows 7, Windows 8, Windows 10[8][3][9] | ReactOS 0.4.8[25] | |
| Display printer queue information or print job information, or control print jobs | IBM PC Network Program[1] | IBM OS/2 LAN Server, OS/2 Warp 4.5[7] | Windows Server 2008, Windows Server 2012, Windows Server 2012 R2, Windows Server 2016, Windows Server (Semi-Annual Channel), Windows 95, Windows 98, Windows NT, Windows 2000, Windows XP, Windows Vista, Windows 8[8][9][26][27][28] | Unimplemented[16] | Deprecated in Windows 7 and Windows Server 2008 R2 | |
| riplmach | No | OS/2 Warp 4.5[7] | No | No | OS/2 Warp 4.5 and later only | |
| riplmclas | No | OS/2 Warp 4.5[7] | No | No | OS/2 Warp 4.5 and later only | |
| run | No | IBM OS/2 LAN Server, OS/2 Warp 4.5[7] | No | No | ||
| send | Send messages to other users or computers | IBM PC Network Program[1] | IBM OS/2 LAN Server, OS/2 Warp 4.5[7] | Windows NT, Windows 2000, Windows XP[8][9] | Unimplemented[16] | |
| separator | Control whether or not a separator page is printed at the beginning of a print file | IBM PC Network Program[1] | No | No | No | |
| session | Manage server computer connections | No | IBM OS/2 LAN Server, OS/2 Warp 4.5[7] | Windows Server 2003, Windows Server 2003 with SP1, Windows Server 2003 with SP2, Windows Server 2003 R2, Windows Server 2008, Windows Server 2008 R2, Windows Server 2008 R2 with SP1, Windows Server 2012, Windows NT, Windows 2000, Windows XP, Windows Vista, Windows 7, Windows 7 with SP1, Windows 8, Windows 10[8][9][3][29][30] | Unimplemented[16] | |
| share | Manage shared resources | IBM PC Network Program[1] | IBM OS/2 LAN Server, OS/2 Warp 4.5[7] | Windows Server 2008, Windows Server 2008 R2, Windows Server 2012, Windows NT, Windows 2000, Windows XP, Windows Vista, Windows 7, Windows 8, Windows 10[8][3][9][31][32] | ReactOS 0.4.8[33] | |
| start | Start services | IBM PC Network Program[1] | IBM OS/2 LAN Server, OS/2 Warp 4.5[7] | Windows 95, Windows 98, Windows NT, Windows 2000, Windows XP, Windows Vista, Windows 7, Windows 8, Windows 10[8][3][9] | ReactOS 0.4.8[34] | |
| statistics | Display and clear list of usage statistics for a workstation | No | IBM OS/2 LAN Server, OS/2 Warp 4.5[7] | Windows NT, Windows 2000, Windows XP, Windows Vista, Windows 7, Windows 8, Windows 10[8][3][9] | ReactOS 0.4.8[35] | |
| status | List information about current network shares and server definition settings | No | IBM OS/2 LAN Server, OS/2 Warp 4.5[7] | No | No | |
| stop | Stop services | No | IBM OS/2 LAN Server, OS/2 Warp 4.5[7] | Windows 95, Windows 98, Windows NT, Windows 2000, Windows XP, Windows Vista, Windows 7, Windows 8, Windows 10[8][3][9] | ReactOS 0.4.8[36] | |
| time | Display remote computer's current time or sync time with remote computer | No | IBM OS/2 LAN Server, OS/2 Warp 4.5[7] | Windows 95, Windows 98, Windows NT, Windows 2000, Windows XP, Windows Vista, Windows 7, Windows 8, Windows 10[8][3][9] | Unimplemented[16] | |
| use | Connect/disconnect computer to/from shared resources, or display information about computer connections | IBM PC Network Program[1] | IBM OS/2 LAN Server, OS/2 Warp 4.5[7] | Windows Server 2000, Windows Server 2003, Windows Server 2003 R2, Windows Server 2008, Windows Server 2008 R2, Windows Server 2012, Windows 95, Windows 98, Windows NT, Windows 2000, Windows XP, Windows Vista, Windows 7, Windows 8, Windows 10, Windows CE .NET 4.2, Windows CE 5.0, Windows Embedded CE 6.0[8][3][9][37][38][4][5][6] | ReactOS 0.4.8[39] | |
| user | Add or modify user accounts, or display user account information | No | IBM OS/2 LAN Server, OS/2 Warp 4.5[7] | Windows Server 2000, Windows Server 2003, Windows Server 2003 R2, Windows Server 2003 with SP1, Windows Server 2008, Windows Server 2012, Windows NT, Windows 2000, Windows XP, Windows Vista, Windows 7, Windows 8, Windows 10[8][3][9][40][41] | ReactOS 0.4.8[42] | |
| ver | Display information about workgroup redirector | No | No | Windows 95, Windows 98[8] | No | |
| view | Display list of domains, computers, or resources shared by specified computers | No | IBM OS/2 LAN Server, OS/2 Warp 4.5[7] | Windows Server 2000, Windows Server 2003, Windows Server 2003 R2, Windows Server 2008, Windows Server 2008 R2, Windows Server 2012, Windows 95, Windows 98, Windows NT, Windows 2000, Windows XP, Windows Vista, Windows 7, Windows 8, Windows 10, Windows CE .NET 4.2, Windows CE 5.0, Windows Embedded CE 6.0[8][3][9][43][44][4][5][6] | Unimplemented[16] | |
| who | List uses who are logged on current or remote domains, display user logon information, and list users with sessions to a specific server | No | IBM OS/2 LAN Server, OS/2 Warp 4.5[7] | No | No |
Example
[edit]The net use command has several network-related functions.
Connecting network drive and printer
[edit]net use can control mounting ("mapping" in Microsoft terminology) drive shares and connecting shared printers in a network environment. This command makes use of the SMB (server message block) and the NetBIOS protocol on port 139 or 445. The basic Windows XP configuration enables this functionality by default. Thus users can connect to and disconnect from shared resources such as computers, printers and drives.
net use can display a list of network-connection information on shared resources.
Null session connections
[edit]net use also connects to the IPC$ (interprocess communication share). This is the so-called null session connection, which allows unauthenticated users.
The basic syntax for connecting anonymously is:
net use \\IP address\IPC$ "" /u:""
For example, typing at the command prompt:
net use \\192.168.1.101\IPC$ "" /u:""
attempts to connect to the share IPC$ of the network 192.168.1.101 as an anonymous user with blank password. If successfully connected to the target machine, a lot of information can be gathered such as shares, users, groups, registry keys and more. This would provide a hacker with a lot of information about a remote user. This has changed in Windows NT 4.0 SP6 already. In Windows 2000 "null session connections" could have been enabled after changes of the system-configuration.
Similar commands in other OSes
[edit]- Novell NetWare
- map for mapping volumes (network drives) to drive letters
- capture for capturing print queues to LPT ports
See also
[edit]References
[edit]- ^ a b c d e f g h i j k l m n IBM PC Network Program 1.0 Users Guide
- ^ a b Net - Services, File/Print shares, Permissions - Windows CMD - SS64.com
- ^ a b c d e f g h i j k l m n o p q r s t MS-DOS and Windows command line net command
- ^ a b c "net (Windows CE .NET 4.2)". docs.microsoft.com.
- ^ a b c "net (Windows CE 5.0)". docs.microsoft.com.
- ^ a b c "net (Windows Embedded CE 6.0)". docs.microsoft.com.
- ^ a b c d e f g h i j k l m n o p q r s t u v w x y z aa ab ac ad ae af ag ah ai aj ak al am Batch files - The NET command
- ^ a b c d e f g h i j k l m n o p q r s t u v w x y z aa ab net commands in The Network Encyclopedia
- ^ a b c d e f g h i j k l m n o p q r s t u v "Net services commands".
- ^ "Reactos/Reactos". GitHub. 3 November 2021.
- ^ "Net computer".
- ^ "Net computer".
- ^ "Reactos/Reactos". GitHub. 3 November 2021.
- ^ "Reactos/Reactos". GitHub. 3 November 2021.
- ^ "Reactos/Reactos". GitHub. 3 November 2021.
- ^ a b c d e f g "Reactos/Reactos". GitHub. 3 November 2021.
- ^ "Net group".
- ^ "Net group".
- ^ "Reactos/Reactos". GitHub. 3 November 2021.
- ^ "Reactos/Reactos". GitHub. 3 November 2021.
- ^ "Reactos/Reactos". GitHub. 3 November 2021.
- ^ "Net localgroup".
- ^ "Net localgroup".
- ^ "Reactos/Reactos". GitHub. 3 November 2021.
- ^ "Reactos/Reactos". GitHub. 3 November 2021.
- ^ "Net print".
- ^ "Net print".
- ^ "Net print". 3 February 2023.
- ^ "Net session".
- ^ "Net session".
- ^ "Net share".
- ^ "Net share".
- ^ "Reactos/Reactos". GitHub. 3 November 2021.
- ^ "Reactos/Reactos". GitHub. 3 November 2021.
- ^ "Reactos/Reactos". GitHub. 3 November 2021.
- ^ "Reactos/Reactos". GitHub. 3 November 2021.
- ^ "Net use".
- ^ "Net use".
- ^ "Reactos/Reactos". GitHub. 3 November 2021.
- ^ "Net user".
- ^ "Net user".
- ^ "Reactos/Reactos". GitHub. 3 November 2021.
- ^ "Net view".
- ^ "Net view".
Further reading
[edit]- David Moskowitz; David Kerr (1993). OS/2 2.1 Unleashed. Sams Publishing. ISBN 978-0672302404.
- Stanek, William R. (2008). Windows Command-Line Administrator's Pocket Consultant, 2nd Edition. Microsoft Press. ISBN 978-0735622623.
- John Paul Mueller (2007). Windows Administration at the Command Line for Windows Vista, Windows 2003, Windows XP, and Windows 2000. John Wiley & Sons. ISBN 978-0470165799.
External links
[edit]- Microsoft TechNet
- "How To Use Net Use Command In Windows Command Line?". poftut. Archived from the original on 2019-04-19.
Net (command)
View on Grokipedianet command is a collection of command-line utilities in Microsoft Windows operating systems designed for network and system administration, enabling tasks such as managing user accounts, groups, shared resources, services, and network connections directly from the Command Prompt or batch scripts.[1] These commands operate on local computers or domain controllers, providing essential tools for IT administrators to configure and troubleshoot Windows environments without graphical interfaces.[1]
Key subcommands of the net command include:
net accounts: Displays or modifies user account policies, such as password age limits and lockout thresholds.net user: Adds, deletes, or manages local or domain user accounts, including setting passwords and account options.[2]net group: Creates, displays, or deletes global groups for domain user organization.net localgroup: Manages local security groups on a computer or domain.net share: Views, adds, or removes shared folders and printers on the network.net startandnet stop: Starts or stops Windows services and displays running service lists.net use: Connects to or disconnects from shared network resources like drives or printers.net view: Lists available computers or shared resources on a network.
/domain) and are particularly useful in server environments like Windows Server for automating administrative routines.[3] While powerful for scripting and remote management, net commands are limited on domain controllers where Group Policy Objects often override local settings.[1]
Introduction
Overview
Thenet command is a command-line utility in Windows NT-based operating systems designed for managing network resources, local users, groups, services, and sessions.[1] It enables administrators to perform essential networking and system administration tasks directly from the command line, facilitating efficient control over shared resources and user interactions in a networked environment.[3]
Among its core capabilities, the net command supports viewing active network connections, mapping network drives to local letters, sharing folders and printers across the network, and executing administrative tasks such as adding or modifying user accounts and groups.[1] These functions are accessed through various subcommands, allowing for scripted automation of routine operations.[3]
The utility is available in both the Command Prompt (cmd.exe) and PowerShell environments, with net.exe serving as the underlying executable file typically located in the System32 directory.[3] It integrates with Server Message Block (SMB) and Common Internet File System (CIFS) protocols to handle interactions with remote resources, such as connecting to shared drives or managing file permissions over the network.[1]
History
The net command, originating from Microsoft LAN Manager, was introduced in Windows NT 3.1 in 1993 as a built-in command-line utility for managing network resources and replacing earlier MS-DOS-based tools like those in Microsoft LAN Manager.[4][5] Subsequent versions saw enhancements for evolving Windows features; in Windows 2000, the command gained integration with Active Directory, enabling operations on domain users, groups, and shares within enterprise environments.[1] A notable milestone in this era was the introduction of netsh alongside Windows 2000, a more advanced scripting tool for network configuration that diminished the need for net in sophisticated networking scenarios. Further updates arrived in Windows Vista to ensure compatibility with User Account Control (UAC), requiring elevated privileges for certain administrative functions while maintaining core functionality.[6] In recent years, particularly after Windows 10, Microsoft has promoted modern alternatives, such as PowerShell cmdlets including New-PSDrive for persistent drive mapping and resource management, alongside the continued use of legacy commands like net.[7]Syntax and Usage
General Syntax
Thenet command in Windows follows the basic syntax net [command] [options] [arguments], where [command] specifies the operation (such as use or view), [options] are switches like /domain to target a specific domain, and [arguments] provide additional parameters like resource paths.[8] This structure allows the command to manage network resources, user accounts, and services from the command line.[9]
Common global options include /help to display detailed usage information for the command or a specific subcommand, /? for quick help summaries, and /domain:<domainname> to apply the operation to a domain controller instead of the local computer (defaulting to the local machine if omitted).[1] Output can be redirected using standard operators like > filename to save results to a file for logging or analysis.[8]
The command returns exit codes to indicate success or failure, with 0 typically denoting successful completion and 2 signaling a syntax error or invalid parameters; other non-zero values correspond to specific errors, which can be decoded using net helpmsg <errorcode>.[10] Environment variables such as %USERDOMAIN% influence behavior by providing the current user's domain context, which the command uses when no explicit domain is specified in options like /user.[11]
Subcommands
The net command provides numerous subcommands for administering network resources, user accounts, shares, and services in Windows environments. These subcommands operate primarily in local mode by default but can target domain controllers with the/domain switch where supported, allowing centralized management in Active Directory setups. Key subcommands include those for mapping drives, viewing resources, managing shares and accounts, controlling services, and retrieving statistics, each with specific parameters to customize operations.
net use connects a local computer to or disconnects it from a shared network resource or controls persistent network connections; without parameters, it lists current connections.[12] The syntax is net use [Device] [\\Computer\Share [Password]] [/user:[Domain\]User] [/persistent:{yes|no}] [/delete], where key parameters include /user for alternate credentials, /persistent:yes to maintain the connection across reboots (default based on last setting), and /delete to remove mappings (use * to delete all). For example, net use Z: \\server\share /user:domain\user /persistent:yes maps a drive persistently. This subcommand works in both local and domain contexts without a dedicated switch, relying on provided credentials.
net view displays a list of computers in the current domain, available domains, or shared resources on a specified computer; without parameters, it shows domain computers.[13] The syntax is net view [\\Computer [/cache] | [/all] | /domain[:DomainName]], with parameters like /all to include hidden administrative shares (e.g., C$), /cache for offline caching status, and /domain to list computers in a specific domain. It operates locally or remotely without domain-specific modes.
net share manages shared resources on the local computer, such as creating, deleting, or modifying file and printer shares; without parameters, it lists all shares.[14] The syntax for creation is net share ShareName=drive:path [/grant:User,Permission] [/users:N | /unlimited] [/remark:"text"] [/cache:Type], where parameters include /grant for permissions (read, change, full), /users to limit concurrent users, /remark for descriptions, and /cache for offline availability options like manual or BranchCache. Deletion uses /delete, e.g., net share ShareName /delete. It applies to local resources only.
net user adds, deletes, modifies, or displays user accounts on a local computer or domain.[2] The syntax is net user [Username {Password | *}] [/add] [/delete] [/domain] [Options], with options like /add to create accounts, /delete to remove them, /active:{yes|no} to enable/disable, /expires:{date|never} for expiration, and /domain to target the domain controller instead of local machine. For example, net user newuser password /add /domain adds a domain user. Local mode (no /domain) affects the standalone computer, while /domain enables centralized administration.
net group adds, displays, or removes global groups in a domain or adds/removes users from groups, facilitating rights assignment for similar network access needs.[15] Global groups are managed in domain environments, typically requiring /domain to target the domain controller. The syntax is net group [GroupName [/add [/comment:"text"]] | /delete] [User1 User2 ... {/add | /delete}] [/domain], where /add creates groups or adds users, /delete removes them, /comment adds descriptions. For instance, net group Sales /add /domain creates a domain group. Local groups are managed using net localgroup.
net localgroup adds, displays, or modifies local security groups on the computer or domain, used for local permissions without affecting domain globals. The syntax mirrors net group but targets local groups: net localgroup [GroupName {/add [/comment:"text"] | /delete}] [/domain] [User ... {/add | /delete}]. It supports /domain for domain-local groups on controllers; otherwise, it manages local machine groups.
net session displays information about active sessions on the local server or disconnects them; without parameters, it lists all sessions with details like username, computer, and idle time.[16] The syntax is net session [\\Computer] [/delete] [/list], where /delete ends a specific session (or all if unspecified, risking data loss), and /list formats output as a list. Aliases include net sessions. It operates on the local server in both local and domain environments.
net config displays or modifies network configuration settings for the workstation or server service, such as autoshares or hidden settings.[1] Syntax includes net config server or net config workstation, revealing parameters like maximum connections without direct modification switches in basic use. It applies locally.
net time synchronizes the local computer's clock with a remote time server or displays the current time from one.[1] Syntax is net time [\\Server [/set [/y]]] , where /set updates the local time and /y confirms without prompting. It functions in local or domain modes via server specification.
net accounts manages account policies, including password and lockout settings, for local computers or domains (using /domain). It cannot be run on domain controllers themselves.[1] Syntax is net accounts [/minpwlen:N] [/maxpwage:{days|unlimited}] [/minpwage:days] [/forceLogoff:{minutes|no}] [/uniquepw:N] [/domain], with parameters like /minpwlen for minimum length (0-14, default 6), /maxpwage for age (1-999 days, default 90), /uniquepw for password history (max 24, default not specified), and /domain for domain policies. Local mode shows or sets standalone policies; /domain manages domain policies from domain-joined non-DC machines.
net file manages open files on a server, closing them or listing details like ID, path, and user. Syntax is net file [ID [/close]], where /close terminates a specific file by ID. It targets server sessions locally.[1]
net pause and net continue pause or resume a running service, such as the print spooler, for maintenance. Syntax is net pause Service or net continue Service. These apply to local services.[1]
net start and net stop start or stop a service, like the server service for sharing. Syntax is net start Service or net stop Service. They control local or dependent services.[1]
net statistics displays performance statistics for a service, such as workstation or server, including sessions and bytes transferred since boot. Syntax is net statistics [workstation | server]. It provides local usage data.[1]
Practical Examples
Resource Mapping
Thenet use subcommand of the net utility is primarily employed to map network drives, enabling users to access shared folders on remote servers as if they were local drives. To map a drive, the basic syntax involves specifying a local drive letter followed by the Universal Naming Convention (UNC) path of the shared resource, such as net use X: \\server\share. This command establishes a connection using the current user's credentials by default; if authentication is required, credentials can be provided via the /user parameter, for example, net use X: \\server\share /user:domain\username password. Upon successful execution, the drive letter X: becomes accessible in File Explorer or command-line operations, allowing seamless file transfer and management.[12]
For persistent mappings that reconnect automatically after reboots, the /persistent:yes option is used, as in net use X: \\server\share /persistent:yes, which stores the connection in the user's profile for future sessions. In contrast, temporary mappings, created without this flag or with /persistent:no, last only for the current session and must be re-established upon logging in again. To disconnect a mapped drive, the command net use X: /delete is applied, which removes the association and frees the drive letter; running net use without parameters lists all active connections for verification. These steps facilitate efficient resource access in networked environments without relying on graphical interfaces.[12]
Printer connections via net use target legacy parallel ports like LPT1, using a similar syntax: net use LPT1: \\server\printer. This redirects print jobs from the local machine to the shared printer on the remote server, though it requires the printer to be shared and accessible over the network. In modern Windows systems, such connections integrate with the Add Printer wizard in the Settings app, where the UNC path entered during setup leverages underlying net use functionality for authentication and mapping; for instance, adding \\server\printer as a network printer prompts for credentials if needed, establishing a persistent link. This method supports older applications that output to LPT ports while bridging to contemporary printing workflows.[12][17]
Common troubleshooting for net use involves addressing access denied errors, often resulting from insufficient permissions on the shared resource or mismatched credentials. To resolve, verify the UNC path format—ensuring it adheres to \\computername\sharename without trailing slashes or invalid characters—and specify explicit credentials with /user if operating in a workgroup without domain trust. Additionally, User Account Control (UAC) may block administrative shares like C$, requiring elevated privileges via "Run as administrator" on the command prompt; testing connectivity with net view \\server beforehand can isolate path or network issues.[18][19]
In a real-world workgroup environment, such as a small office without Active Directory, connecting to a shared folder might proceed as follows: first, identify the server via net view \\server to list available shares; then map the drive with net use Z: \\workstation\documents /user:localuser password /persistent:yes, granting access to collaborative files like reports or templates. This process ensures reliable, credential-secured access across peer-to-peer networks, enhancing productivity for non-domain-joined systems.[12]
Administrative Tasks
Thenet command facilitates key administrative tasks on Windows systems, enabling server operators to manage shared resources, monitor and control user sessions, start or stop services, and retrieve performance statistics. These functions are essential for maintaining network servers, particularly in domain environments where centralized control is required. By leveraging the underlying Server Message Block (SMB) protocol and Remote Procedure Call (RPC) mechanisms, administrators can perform these operations locally or remotely, ensuring efficient resource allocation and system stability.[1]
Resource sharing is a core administrative function handled by the net share subcommand, which allows creation, modification, and deletion of network shares for folders and printers. To create an unlimited share for a folder, the syntax is net share ShareName=drive:\path /unlimited, such as net share PublicShare=C:\Public /unlimited, granting access without user limits until permissions are adjusted via other tools. For removal, net share ShareName /delete unshares the resource, as in net share PublicShare /delete, which immediately revokes network access while preserving local files. These operations require administrative privileges and are logged in the system event log for auditing.
Session management uses the net session subcommand to view or terminate active connections to the server, helping administrators disconnect idle or unauthorized users to free resources. Running net session without parameters lists all current sessions, displaying client computer names, usernames, and connection times. To close all sessions, net session /delete forcibly ends them, potentially interrupting ongoing file transfers. For remote management, net session \\RemoteComputer /delete targets sessions on a specified machine, useful in multi-server setups. This subcommand operates on the local server by default but relies on RPC for remote execution.
Service control is achieved through net start and net stop subcommands, which interact with the Windows Service Control Manager to manage background processes without graphical interfaces. For instance, net start spooler initiates the Print Spooler service, essential for printing functionality, while net stop spooler halts it for maintenance, such as clearing print queues. The general syntax is net start ServiceName to launch a service if it is not running, and net stop ServiceName to terminate it gracefully, allowing dependent services to complete tasks. These commands support scripting for automated server reboots or updates and require elevated privileges to prevent unauthorized changes.[20]
Viewing system statistics with net statistics provides insights into workstation or server performance, aiding in troubleshooting and capacity planning. The command net statistics workstation outputs metrics like bytes sent/received, files opened, and connection attempts since the last reboot, helping identify bottlenecks in file sharing or network usage. Similarly, net statistics server displays server-specific data, such as shares accessed and sessions established. These reports are text-based and can be redirected to files for analysis, offering a quick alternative to Performance Monitor for basic diagnostics.[1]
Security Considerations
Vulnerabilities
Thenet command, particularly subcommands like net use, has historically enabled null sessions, allowing anonymous access to remote systems via commands such as net use \\server\IPC$ "" /user:"" without providing credentials, which facilitates enumeration of users, shares, and other resources over SMB.[21] This vulnerability stems from default configurations in older Windows versions that permitted unauthenticated connections to the IPC$ administrative share, exposing sensitive network information to attackers.[22] Microsoft introduced registry-based mitigations for null sessions in Windows 2000 via the RestrictAnonymous setting, though it required manual configuration for full restriction; stricter defaults were implemented in subsequent versions like Windows XP.[23] Legacy and misconfigured systems remain susceptible if not hardened.[24]
Privilege escalation risks arise when users with sufficient local privileges employ net localgroup to add accounts to high-privilege groups, such as the Administrators group, via commands like net localgroup Administrators <username> /add, granting unauthorized elevated access.[25] This technique is commonly abused by adversaries who have obtained initial low-level access, allowing them to maintain persistence or expand control within a Windows environment.[25]
In SMB relay attacks, the net use subcommand can inadvertently aid credential capture by establishing NTLM-authenticated sessions that attackers intercept and relay in man-in-the-middle scenarios, such as through LLMNR/NBT-NS poisoning, to authenticate to other systems without the user's knowledge.[26] Tools like Responder exploit this by relaying captured hashes from net use connections to target servers, potentially compromising domain controllers or shares.[27]
The EternalBlue exploit (CVE-2017-0144) targets a buffer overflow in SMBv1, enabling remote code execution that interacts with net share operations by allowing attackers to enumerate, create, or access network shares post-compromise without authentication.[28] This vulnerability, patched in MS17-010, was widely used in ransomware campaigns like WannaCry to propagate laterally via SMB shares managed or queried by net share.[29]
Post-2020 ransomware variants, such as Conti, leverage net stop to disrupt services by halting up to 146 Windows processes related to security, backups, and databases—e.g., net stop WinDefend—preventing detection and recovery during encryption.[30] This tactic inhibits system recovery and amplifies impact, as seen in attacks on critical infrastructure where service shutdowns preceded data exfiltration.[31]
Best Practices
When using thenet command for network operations, authentication should always incorporate the /user and /password options to specify credentials explicitly, ensuring secure connections to remote resources.[12] Strong credentials, meeting complexity requirements such as a minimum of 14 characters without common patterns, must be employed to mitigate brute-force risks.[32] To prevent null sessions, which allow unauthenticated access, enable the Group Policy 'Network access: Restrict anonymous access to Named Pipes and Shares', which sets RestrictNullSessAccess to 1 under HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\LanManServer\Parameters, restricting unauthenticated access to named pipes and shares except for specified exceptions.[33]
Adhering to the principle of least privilege is essential; execute net commands from non-administrative accounts whenever feasible to limit potential damage from misuse or compromise.[34] Enforce account policies using net accounts /lockoutthreshold:10 to lock accounts after 10 failed attempts, balancing security against denial-of-service risks while aligning with Windows security baselines.[35]
For auditing, enable process creation auditing in Group Policy under Advanced Audit Policy Configuration > Detailed Tracking to log net command executions in Event Viewer (Event ID 4688), capturing command-line arguments for review.[36] Regularly monitor active connections with net session to detect and terminate unauthorized access promptly.[1]
In scripting scenarios involving sensitive tasks like drive mapping, opt for PowerShell cmdlets such as New-PSDrive with Get-Credential over net use, as the former stores passwords as secure strings rather than plain text, reducing exposure risks.[37]
Alternatives in Other Systems
Unix-like Equivalents
In Unix-like systems such as Linux and macOS, functionalities akin to the Windowsnet command's subcommands for network resource access and management are provided by tools from the Samba suite, which implements the SMB/CIFS protocol, along with standard system utilities for user and group administration.[38][39]
For connecting to remote SMB shares, similar to net use, the smbclient command serves as a primary equivalent, offering an FTP-like interface to interact with SMB/CIFS servers. Users can connect to a share using syntax such as smbclient //server/share -U username, which authenticates and provides shell access for file transfer and directory navigation.[38] To mount shares persistently, akin to mapping a drive, the mount.cifs utility is employed, for example: mount -t cifs //server/share /mnt/point -o username=user,password=pass.[40] This allows integration into the local filesystem, supporting options for credentials, security levels, and vers= for SMB protocol versions.[40]
Resource discovery and listing, comparable to net view, rely on nmblookup for NetBIOS name resolution and smbclient -L for enumerating available shares on a server. The nmblookup tool queries NetBIOS names over TCP/IP to map hostnames to IP addresses, such as nmblookup -A ip.address to retrieve node status.[41] Complementing this, smbclient -L //server -U user lists shares, workgroups, and printers exposed by the target server.[38]
User and group management in Unix-like systems diverges from net user and net group by using dedicated commands like useradd and usermod for accounts, and groupadd for groups, often integrated with tools like passwd for password handling. For instance, useradd -m -s /bin/bash newuser creates a user with a home directory and shell, while usermod -aG group user adds a user to a group; these operate on local or LDAP-backed databases rather than Windows domains.[42] Similarly, groupadd newgroup establishes groups for access control.
To configure file sharing, equivalent to net share, administrators edit the /etc/samba/smb.conf file to define shares, global settings, and authentication, then restart the smbd service; for example, a section like [myshare] path = /path/to/dir read only = no exposes a directory via SMB.[43] This contrasts with Windows-centric net by emphasizing textual configuration over command-line immediacy.
Key differences include the net command's tight integration with Windows SMB for domain-centric operations versus Unix-like systems' flexibility with both NFS and CIFS protocols through Samba, allowing broader interoperability.[38] Additionally, no single command directly mirrors net statistics for workstation/server stats; instead, sar -n DEV from the sysstat package reports network interface activity, and iostat provides I/O metrics, offering historical and real-time system-wide insights.[44]
Modern Windows Tools
In modern Windows environments, particularly Windows 11 and Windows Server 2025, PowerShell cmdlets provide robust, object-oriented alternatives to many net command functions, enabling more advanced scripting and automation. For instance, theNew-PSDrive cmdlet serves as the primary equivalent to net use, allowing users to create temporary or persistent drives mapped to network locations, such as SMB shares, with support for credentials and persistence across sessions.[45] Similarly, Get-SmbShare retrieves detailed information about SMB shares on local or remote systems, mirroring net share but returning structured .NET objects that facilitate piping to other cmdlets for further processing, such as filtering or exporting data.[46] For service management, Get-Service lists services akin to net start or net stop, while Start-Service and Stop-Service initiate or halt them, offering granular control over status, dependencies, and remote execution without the limitations of text-based output in net commands.[47][48]
Graphical user interface (GUI) tools in Windows further complement or replace net command tasks, providing intuitive access for non-scripting users. File Explorer allows mapping network drives through its "Map network drive" option, which prompts for drive letters, folder paths, and credentials, effectively replicating net use in a visual workflow that supports reconnection at sign-in.[49] The Services console, accessible via services.msc, enables starting, stopping, and configuring services interactively, serving as a direct GUI counterpart to net start and net stop with real-time status monitoring and dependency views.[50] For local user and group administration, the Computer Management console (compmgmt.msc) offers a centralized interface under Local Users and Groups to add, modify, or delete accounts, paralleling net user and net localgroup while integrating with broader system management features.[51]
The netsh command-line utility extends beyond the net command's focus on user and share management, addressing advanced networking configurations that net lacks. It supports contexts like netsh interface for IP addressing, VLANs, and adapter settings, or netsh bridge for combining network segments, filling gaps in net's scope by enabling scripted network diagnostics and policy enforcement on Windows Server and client editions.[52][53][54]
Migrating to these tools from net is recommended for enhanced automation, as PowerShell's pipeline model and .NET integration allow complex operations like querying shares and exporting results to CSV, unlike net's plain-text responses, while maintaining backward compatibility since the net command remains fully supported in Windows 11 for legacy scripts and applications.[3][55] In Windows 11 and later, integration with Microsoft Entra ID (formerly Azure AD) further diminishes reliance on net for domain tasks, as hybrid or Entra-joined devices shift user and device management to cloud-based tools like Intune, reducing on-premises domain queries via net commands in favor of API-driven authentication and policy application.[56][57]