Saturday, April 13, 2024

Net command examples to Manage Windows Resources

NET COMMAND EXAMPLES TO MANAGE WINDOWS RESOURCES

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.

 

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.

 

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.

 

Example 3: 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 TSA with password Tsa@123 using net user TSA Tsa@123 /add command as shown below

 

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.

 

Example 5: 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 TSA to Tsa#123 using net user TSA Tsa#123 command as shown below.

 

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 tsa using net user tsa /delete command as shown below.

 

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.

 

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.

 

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 TSA to Administrators group using net localgroup administrators TSA /add command as shown below.

 

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> /del syntax. In this example we are removing user TSA from administrators group by using net localgroup administrators TSA /del command as shown below.

 

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 Techsecurity.asia is a member in a file called groupname.txt by using net user /domain Techsecurity.asia >> groupname.txt command as shown below.

 

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.

 

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-TSA\c$ * /USER:TSA\Techsecurity.asia command as shown below.

NOTE:

Please note that here I am using domain account TSA for copying all the files and folders from DESKTOP-TSA system to current system

 

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.

 

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 sharename=drive:path syntax. In this example we are looking to share a file tsa available under d drive with the alias tsa using net share tsa="d:\tsa  command as shown below.

 

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> /del syntax. In this example we are stop sharing TSA folder using net share TSA /del command as shown below.

 

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 

 

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 TSA user account by using net user /domain Techsecurity.asia | find /i "Account active" command as shown below.

 

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 Techsecurity.asia using net group "Internet Access Group" Techsecurity.asia /add /domain command as shown below.

 

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 TSA using net user TSA /DOMAIN /ACTIVE:YES command.

 

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 tsa user account by using net user TSA /DOMAIN | FIND /I "Account active" command as shown below.

 

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.

 

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 TSA by using net user TSA /domain | findstr /C:"Last logon" command as shown below.

 

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.

 

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.

 

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>: /del syntax. In this example we are unmapping E drive using net use e: /del command as shown below.

 

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.

Thien Tek95
Thien Tek95https://trungthienit.com/
I am Thien Tek, i like Technology security. i has successfully completed all requirenments and criteria for Cerfied Ethical Hacker, view here. Certification Ethical Hacker Contact US: 0902 03 1995
Latest news
Related news

LEAVE A REPLY

Please enter your comment!
Please enter your name here