The net command is a versatile Windows command-line utility used for managing and configuring various network resources and services. It provides a wide range of subcommands that allow administrators and power users to perform tasks such as managing user accounts, network shares, services, sessions, and more.
Used to connect, disconnect, and manage network drives or printers.
-
Purpose:
Map a network share to a local drive letter, view existing connections, or disconnect them. -
Examples:
- Map a drive:
net use Z: \\Server\Share - Connect with credentials:
net use Z: \\Server\Share /user:DOMAIN\username password - List active connections:
net use - Disconnect a mapped drive:
net use Z: /delete
- Map a drive:
Manages user accounts on the local machine or domain.
-
Purpose:
Create, modify, and delete user accounts. -
Examples:
- Display user information:
net user username - Create a new user:
net user newuser password /add - Delete a user:
net user username /delete - Change a user password:
net user username newpassword
- Display user information:
Manages global groups on a domain (if executed in a domain context).
-
Purpose:
Create, modify, and display domain groups. -
Examples:
- List group members:
net group GroupName - Add a user to a group:
net group GroupName username /add - Remove a user from a group:
net group GroupName username /delete
- List group members:
Manages local groups on a computer.
-
Purpose:
Create, modify, and display local groups. -
Examples:
- List local group members:
net localgroup GroupName - Add a user to a local group:
net localgroup GroupName username /add - Remove a user from a local group:
net localgroup GroupName username /delete
- List local group members:
Manages shared resources on a computer.
-
Purpose:
Create, delete, and display network shares. -
Examples:
- List shares:
net share - Create a share:
net share ShareName=C:\Path\To\Folder /grant:username,full - Delete a share:
net share ShareName /delete
- List shares:
Starts or stops Windows services.
-
Purpose:
Control the running state of services. -
Examples:
- List running services:
net start - Start a service:
net start ServiceName - Stop a service:
net stop ServiceName
- List running services:
Manages sessions between the local computer and others on the network.
-
Purpose:
Display or disconnect sessions with other computers. -
Examples:
- List active sessions:
net session - Disconnect a session:
net session \\ComputerName /delete
- List active sessions:
Manages shared files that are open on a server.
-
Purpose:
List open files and disconnect files that are being used. -
Examples:
- Display open files:
net file - Close an open file by its ID:
net file <ID> /close
- Display open files:
Synchronizes the computer's clock with a time server.
-
Purpose:
Query and set the system time. -
Examples:
- Display the current time from a server:
net time \\TimeServer
- Synchronize the system clock with a server:
net time \\TimeServer /set /yes
- Display the current time from a server:
Displays network statistics, including server and workstation statistics.
-
Purpose:
Provide diagnostic information about network performance. -
Examples:
- Show workstation statistics:
net statistics workstation - Show server statistics:
net statistics server
- Show workstation statistics:
Manages password and logon requirements for user accounts.
-
Purpose:
Set policies related to passwords, lockout thresholds, and logon hours. -
Examples:
- Display current account policies:
net accounts - Set minimum password length:
net accounts /minpwlen:8
- Display current account policies:
Configures server and workstation settings.
-
Purpose:
Display or modify configuration settings for network services. -
Examples:
- Display server configuration:
net config server - Display workstation configuration:
net config workstation
- Display server configuration:
The net command is a powerful tool that enables administrators and users to manage various network tasks directly from the Windows command line. Whether you need to manage user accounts, configure network shares, control services, or handle network sessions, the numerous subcommands of net provide a comprehensive set of functionalities essential for everyday network administration. Each subcommand addresses a specific area of network management, making net a central command for troubleshooting and configuring Windows network resources.