\\ Amazon パソコン・周辺機器 クーポンをチェックしよう!! //

How to Use the Windows NET Command | Efficiently Manage Network Resources and Users

目次

What is the NET Command?

The NET command in Windows is a powerful tool used to manage network resources, user accounts, services, and more from the command line. This command allows you to add or remove user accounts, manage groups, configure shared folders, and start or stop services. It is essential for system administrators and IT professionals looking to automate and streamline everyday network management tasks.

NET Command Syntax

NET
    [ ACCOUNTS | COMPUTER | CONFIG | CONTINUE | FILE | GROUP | HELP |
      HELPMSG | LOCALGROUP | PAUSE | SESSION | SHARE | START |
      STATISTICS | STOP | TIME | USE | USER | VIEW ]

Each subcommand is used to execute specific management tasks. Below are key subcommands and their uses.

Key Subcommands and Their Uses

  1. NET USER
    Manage user accounts (create, delete, change passwords, etc.).
  • Example:
    • View user accounts:
      bash NET USER
    • Create a new user:
      bash NET USER newuser password /ADD
    • Delete a user account:
      bash NET USER username /DELETE
  1. NET LOCALGROUP
    Manage local groups (add or remove users from groups).
  • Example:
    • View groups:
      bash NET LOCALGROUP
    • Add a user to a group:
      bash NET LOCALGROUP groupname username /ADD
    • Remove a user from a group:
      bash NET LOCALGROUP groupname username /DELETE
  1. NET SHARE
    Manage shared network folders (create, delete, view).
  • Example:
    • View shared folders:
      bash NET SHARE
    • Create a new shared folder:
      bash NET SHARE sharename=C:\folderpath
    • Delete a shared folder:
      bash NET SHARE sharename /DELETE
  1. NET START / STOP
    Start or stop Windows services.
  • Example:
    • View running services:
      bash NET START
    • Start a service:
      bash NET START servicename
    • Stop a service:
      bash NET STOP servicename
  1. NET SESSION
    Manage current sessions, view or disconnect remote sessions.
  • Example:
    • View current sessions:
      bash NET SESSION
    • Disconnect a session:
      bash NET SESSION sessionname /DELETE
  1. NET COMPUTER
    Manage computer accounts in a domain environment.
  • Example:
    • View domain computers:
      bash NET COMPUTER
    • Add a computer account:
      bash NET COMPUTER computername /ADD
  1. NET CONFIG
    Display network service configuration information.
  • Example:
    • View configuration:
      bash NET CONFIG
  1. NET HELP / HELPMSG
    Display help information for NET commands.
  • Example:
    • View overall help:
      bash NET HELP
    • View help for a specific subcommand:
      bash NET HELPMSG subcommand

Detailed Subcommands Overview

  1. NET ACCOUNTS
    Manage user account policies (password policies, account lockout policies).
  • Example:
    • Set minimum password length:
      bash NET ACCOUNTS /MINPWLEN:8
  1. NET FILE
    View shared file information and close open file handles.
  • Example:
    • View open files:
      bash NET FILE
  1. NET GROUP
    Manage domain groups (primarily used in domain environments).
  • Example:
    • View domain groups:
      bash NET GROUP
  1. NET VIEW
    View shared resources and computers on the network.
  • Example:
    • View shared resources:
      bash NET VIEW
  1. NET USE
    Map or disconnect network drives.
  • Example:
    • Map a network drive:
      bash NET USE Z: \\servername\sharename

Practical Use Cases for NET Command

1. Create a New User and Add Them to a Group

NET USER newuser password /ADD
NET LOCALGROUP "Administrators" newuser /ADD

This creates a new user account and adds the user to the “Administrators” group, granting them admin privileges.

2. Map and Disconnect a Network Drive

NET USE X: \\server\share /USER:username password
NET USE X: /DELETE

This command maps a network share to drive X and then disconnects the mapped drive when no longer needed.

3. Create and Delete a Shared Folder

NET SHARE sharename=C:\sharedfolder /GRANT:username,FULL
NET SHARE sharename /DELETE

This command shares a folder with full permissions and deletes the share when no longer needed.

Important Considerations When Using the NET Command

  • Administrator privileges required: Most NET commands require administrator rights. Be sure to run the command prompt as an administrator.
  • Accurate command input: Ensure correct syntax for user and group names to avoid errors.
  • Understanding network environment: Some subcommands and options vary depending on whether you are working in a domain or workgroup environment.

Conclusion

The NET command is a robust tool for efficiently managing network resources and user accounts in Windows. Whether you are managing user accounts, shared folders, or network services, this command simplifies and automates many common administrative tasks. By mastering the NET command, system administrators can significantly improve management efficiency in their Windows environments.

Tamaglo

Thank you for reading to the end!

Comments

To comment

The maximum upload file size: 2 MB. You can upload: image. Links to YouTube, Facebook, Twitter and other services inserted in the comment text will be automatically embedded. Drop file here

目次