net

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.

Key Subcommands

1. net use

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

2. net user

Manages user accounts on the local machine or domain.

  • Purpose: Create, modify, and delete user accounts.

  • Examples:

    • Display user information:

    • Create a new user:

    • Delete a user:

    • Change a user password:

3. net group

Manages global groups on a domain (if executed in a domain context).

  • Purpose: Create, modify, and display domain groups.

  • Examples:

    • List group members:

    • Add a user to a group:

    • Remove a user from a group:

4. net localgroup

Manages local groups on a computer.

  • Purpose: Create, modify, and display local groups.

  • Examples:

    • List local group members:

    • Add a user to a local group:

    • Remove a user from a local group:

5. net share

Manages shared resources on a computer.

  • Purpose: Create, delete, and display network shares.

  • Examples:

    • List shares:

    • Create a share:

    • Delete a share:

6. net start / net stop

Starts or stops Windows services.

  • Purpose: Control the running state of services.

  • Examples:

    • List running services:

    • Start a service:

    • Stop a service:

7. net session

Manages sessions between the local computer and others on the network.

  • Purpose: Display or disconnect sessions with other computers.

  • Examples:

    • List active sessions:

    • Disconnect a session:

8. net file

Manages shared files that are open on a server.

  • Purpose: List open files and disconnect files that are being used.

  • Examples:

    • Display open files:

    • Close an open file by its ID:

9. net time

Synchronizes the computer's clock with a time server.

  • Purpose: Query and set the system time.

  • Examples:

    • Display the current time from a server:

    • Synchronize the system clock with a server:

10. net statistics

Displays network statistics, including server and workstation statistics.

  • Purpose: Provide diagnostic information about network performance.

  • Examples:

    • Show workstation statistics:

    • Show server statistics:

11. net accounts

Manages password and logon requirements for user accounts.

  • Purpose: Set policies related to passwords, lockout thresholds, and logon hours.

  • Examples:

    • Display current account policies:

    • Set minimum password length:

12. net config

Configures server and workstation settings.

  • Purpose: Display or modify configuration settings for network services.

  • Examples:

    • Display server configuration:

    • Display workstation configuration:

Conclusion

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.

Last updated