Table of Contents
In this article, I will take you through 27 Important net command examples to Manage Windows Resources. If you are a Windows command line lover then I am sure you are going to like this article. net command in Windows is used to manage groups, users, account policies and so on. You can use this command not only for your local system resources but for your domain resources as well. We will see some interesting net command examples in below section. More on Microsoft docs.
Useful net command examples to Manage Windows Resources
Also Read: 20 Useful wmic command examples in Windows | Cheat Sheet
Example 1: How to Start a Service in Windows using net command
If you want to start a service in windows then you need to use net start <service>
syntax. In this example we are starting Windows Update Service by using net start wuauserv
command as shown below.
C:\>net start wuauserv
The Windows Update service is starting.
The Windows Update service was started successfully.
Example 2: How to Stop a Service in Windows using net command
If you want to stop a service in windows then you need to use net stop <service>
syntax. In this example we are stopping Windows Update Service by using net stop wuauserv
command as shown below.
C:\>net stop wuauserv
The Windows Update service is stopping.
The Windows Update service was stopped successfully.
Example 3: How to Change User Password in Windows using net command
You can also change a user credentials using net command in Windows. In this example we are changing the password of user cyberithub
to pass123
using net user cyberithub pass123
command as shown below.
C:\>net user cyberithub pass123
The command completed successfully.
Example 4: How to Get the List of all Users in the System
You can use net user
command to check all the local users in the System.
C:\>net user
User accounts for \\DESKTOP-JSK6PD
-------------------------------------------------------------------------------
Administrator cyberithub DefaultAccount
Guest WDAGUtilityAccount
The command completed successfully.
Example 5: How to Add a Local User in the System
If you want to add any local user in the system then you need to use net user <user_name> <password> /add
syntax. In this example we are adding a local user cyberithub
with password pass123
using net user cyberithub pass123 /add
command as shown below.
C:\>net user cyberithub pass123 /add
The command completed successfully.
Example 6: How to Delete a User from the System
If you want to delete a local user from the System then you need to use net user <user_name> /delete
syntax. In this example we are deleting user cyberithub
using net user cyberithub /delete
command as shown below.
C:\>net user cyberithub /delete
The command completed successfully.
Example 7: How to Get the List of All Local Groups
To get the list of all Local Groups, you can use net localgroup
command as shown below.
C:\>net localgroup
Aliases for \\DESKTOP-JSK6PD
-------------------------------------------------------------------------------
*Administrators
*Device Owners
*Distributed COM Users
*Event Log Readers
*Guests
*Hyper-V Administrators
*IIS_IUSRS
*Performance Log Users
*Performance Monitor Users
*Remote Management Users
*System Managed Accounts Group
*Users
The command completed successfully.
Example 8: How to Get the List of all the members of a Local Group
If you want to check the list of all the members of a local group then you need to use net localgroup <group_name>
syntax. In this example we are checking the list of all the members of Administrators
group using net localgroup Administrators
command as shown below.
C:\>net localgroup Administrators
Alias name Administrators
Comment Administrators have complete and unrestricted access to the computer/domain
Members
-------------------------------------------------------------------------------
Administrator
cyberithub
The command completed successfully.
Example 9: How to Add a User into a Local Group
Using net command you can also add a user to a local group. In this example we are adding a User cyberithub
to Administrators
group using net localgroup administrators cyberithub /add
command as shown below.
C:\>net localgroup administrators cyberithub /add
The command completed successfully.
Example 10: How to Remove User from a Local Group
If you want to remove a user from a local group then you need to use net localgroup <group_name> <user_name> /delete
syntax. In this example we are removing user cyberithub
from administrators
group by using net localgroup administrators cyberithub /delete
command as shown below.
C:\>net localgroup administrators cyberithub /delete
The command completed successfully.
Example 11: How to Save all the group members of current domain User in a File
If you want to save all the group members of current domain user in a file then you need to use net user /domain <user_account> >> <file.txt>
syntax. In this example we are saving all the groups which user john.wick
is a member in a file called groupname.txt
by using net user /domain john.wick >> groupname.txt
command as shown below.
C:/>net user /domain john.wick >> groupname.txt
Example 12: How to Save all the members of a Group in a File
You can also save the details of the members of a group in a file by using redirection operator. In this example we are saving all the members of ITGroup
to a file abc.txt
using net group ITGroup /domain >c:\abc.txt
command as shown below.
C:\>net group ITGroup /domain >c:\abc.txt
Example 13: How to Copy the Contents from another System
If you want you can also copy the contents from another system using net use
command. In this example we are copying entire c
drive content of DESKTOP-THKO9
system in the current folder of our system using net use \\DESKTOP-THKO9\c$ * /USER:mx\john.wick
command as shown below.
NOTE:
C:\>net use \\DESKTOP-THKO9\c$ * /USER:mx\john.wick
Example 14: How to Share a Folder with Specific Permission
You can share a folder with some specific permission then you can use below net share
command. In this example we are publicly sharing s:\Public
file with GRANT
access given to Everyone
using net share Public=s:\Public /GRANT:Everyone,FULL
command as shown below.
C:\>net share Public=s:\Public /GRANT:Everyone,FULL
Example 15: How to Share a Folder with Alias
If you are looking to share a folder using some alias then you need to use net share list="<share_file_path> <alias>"
syntax. In this example we are looking to share a file art
available under c
drive with the alias lst
using net share list="c:\art lst"
command as shown below.
C:\>net share list="c:\art lst"
Example 16: How to Stop Sharing a Folder
If you want to stop sharing a folder then you need to use net share <folder_name> /delete
syntax. In this example we are stop sharing DataShare
folder using net share DataShare /delete
command as shown below.
C:\>net share DataShare /delete
Example 17: How to Check all the Shared Folders
If you want to check all the shared folders then you need to use net share
command as shown below.
C:\>net share
Share name Resource Remark
-------------------------------------------------------------------------------
C$ C:\ Default share
D$ D:\ Default share
E$ E:\ Default share
IPC$ Remote IPC
ADMIN$ C:\Windows Remote Admin
soft C:\Users\cyberithub\Downloads\soft
Users C:\Users
The command completed successfully.
Example 18: How to Check If a User Account is Locked
If you want to check a user account is locked or not then you need to check "Account Active"
status from net user /domain <user_name>
command. In this example we are checking John Wick
user account by using net user /domain john.wick | find /i "Account active"
command as shown below.
C:\>net user /domain john.wick | find /i "Account active"
Example 19: How to Add a Group to Domain User
If you want to add a group to current domain user then you need to use net group <group_name> <user_name> /add /domain
syntax. In this example we are adding "Internet Access Group" to user John Wick using net group "Internet Access Group" john.wick /add /domain
command as shown below.
C:\>net group "Internet Access Group" john.wick /add /domain
Example 20: How to Unlock a Domain User Account
If you want to unlock a current domain user account then you need to use net user <user_name> /DOMAIN /ACTIVE:YES
command as shown below. In this example we are unlocking account of user John Wick using net user john.wick /DOMAIN /ACTIVE:YES
command.
C:\>net user john.wick /DOMAIN /ACTIVE:YES
Example 21: How to Check If the Domain User is Active
If you want to check current domain user is active or not then you need to use net user <user_account> /domain | FIND /I "Account Active"
syntax. In this example we are checking about john.wick
user account by using net user john.wick /DOMAIN | FIND /I "Account active"
command as shown below.
C:\>net user john.wick /DOMAIN | FIND /I "Account active"
Example 22: How to List all the workgroups in current Domain
If you want to check all the workgroups in current domain then you need to use net view /domain
command as shown below.
C:\>net view /domain
Example 23: How to Check Last Login time of User in Current Domain
If you want check the Login time of any user in current domain then you need to look for "Last Logon"
from net user <user_name> /domain
output. In this example we are checking the last login time of user John
by using net user john /domain | findstr /C:"Last logon"
command as shown below.
C:\>net user john /domain | findstr /C:"Last logon"
Example 24: How to Check the List of Configurable Services
If you want to check the list of configurable services then you need to use net config
command as shown below.
C:\>net config
The following running services can be controlled:
Server
Workstation
The command completed successfully.
Example 25: How to Check the Workstation Stats
If you are looking to check the complete workstation stats then you need to use net stats workstation
command as shown below.
C:\>net stats workstation
Workstation Statistics for \\DESKTOP-JSK6PD
Statistics since 25-07-2021 23:09:17
Bytes received 177864
Server Message Blocks (SMBs) received 1
Bytes transmitted 163656
Server Message Blocks (SMBs) transmitted 0
Read operations 0
Write operations 0
Raw reads denied 0
Raw writes denied 0
Example 26: How to remove a currently mapped drive
If you are looking to unmap the currently mapped drive then you need to use net use <drive>: /delete
syntax. In this example we are unmapping E
drive using net use e: /delete
command as shown below.
C:\>net use e: /delete
Example 27: How to Check all the Options available with net command
If you want to check all the switches available with net command then you need to use net help
command as shown below.
C:\>net help
The syntax of this command is:
NET HELP
command
-or-
NET command /HELP
Commands available are:
NET ACCOUNTS NET HELPMSG NET STATISTICS
NET COMPUTER NET LOCALGROUP NET STOP
NET CONFIG NET PAUSE NET TIME
NET CONTINUE NET SESSION NET USE
NET FILE NET SHARE NET USER
NET GROUP NET START NET VIEW
NET HELP
NET HELP NAMES explains different types of names in NET HELP syntax lines.
NET HELP SERVICES lists some of the services you can start.
NET HELP SYNTAX explains how to read NET HELP syntax lines.
NET HELP command | MORE displays Help one screen at a time.