How To Use The Net Command

In this article, I will show you how to use the Net command in Windows.

Networking books on Amazon

The Net command is built into the Windows operating system. It has a lot of functions and is very useful. There are many sub-commands to use with it. I will be going over several with examples.


Net Account

This command is used to set policy settings on your local computer. These settings include such things as account and password policies. You can start with:

Net account

This will show you the current policy settings on your workstation.

You can change these settings like this:

Net accounts /forcelogoff:20

Net accounts forcelogoff:no

Net accounts /minpwlen:10

Net accounts /maxpwage:60 (days)

Net accounts /maxpwage:unlimited

Net accounts /minpwage:10 (days)


Net Use

This command will connect a computer to a shared resource. It will also disconnect a computer from a shared resource. You can make these connections persistent also. Used by itself, it will give you a list of current connections.

To see list of current connections:

Net use

To assign the drive letter f: to a shared music directory:

Net use f: \\sharedcomputer\music

To assign a drive letter to another directory on the same resource:

Net use j: \\sharedcomputer\currentuser

To disconnect from the shared music folder:

Net use f: \\sharedcomputer\music /delete

To make any of the connections persistent after log off:

Net use f: \\sharedcomputer\music /persistent:yes


Net User

This will add or modify user accounts. It will also display account information for any user on the system. 

You can run it by itself to get a list of users on the machine you are working on:

Net user

To see information on a user:

Net user Jason

To add a new user with some requirements:

Net user jason2 password /add /passwordreq:yes /times:monday-friday,8am-5pm /fullname:”Jason Moore”

Net Share

This command manages shared resources. Used by itself it will show you basic information about all of the shared resources on your computer. To share a directory with a path that contains spaces, enclose the path in quotation marks.

To see shared resources on your computer:

Net share

To share your music directory with your household:

Net share MusicShare=c:\Music

To stop sharing your music folder:

Net share MusicShare /delete

To share your script directory with a coworker:

Net share ScriptShare=”c:\My Scripts”


Net Localgroup

This command will add members or display members of local groups on your computer. It can also modify the groups. When you use the /domain parameter, it will only work on computers that are part of a domain. 

To see what local groups are on your computer:

Net localgroup

To add a local group to your computer:

Net localgroup PythonUsers /add

To add a local group to a computer that is on a domain:

Net localgroup PythonUsers /add /HouseDomain

To add existing user accounts to a domain:

Net localgroup PythonUsers person1 person2 /add

To add these same users to a local group that is on a domain:

Net localgroup PythonUsers person1 person2 /add /HouseDomain

To see who is in a local group:

Net localgroup PythonUsers

To add a comment to a local group:

Net localgroup PythonUsers /comment:”These users are Python developers”


Net Computer

This lets you add or delete a computer from the domain. When you run this command with admin rights, it will send the information to your domain controller.

To add a computer to your domain:

Net computer \\pc1 /add

To delete a computer from the domain:

Net computer \\pc1 /delete


Net Config

This command is used to see and modify network resources. 

To see information regarding your workstation:

Net config workstation

To see more network related information:

Net config rdr

To change the session timeout length:

Net config workstation /autodisconnect:20 (this is in minutes)

To disable timeouts:

Net config workstation /autodisconnect:-1

To change the comment about this workstation:

Net config workstation /srvcomment:”This is Jason’s Workstation”


Net File

This command will list all open shared files. You can use it to close files and remove their locks if there are any. When you list the open files there will be an ID. You use this ID to reference the file and work with it. 

To see open files:

Net file

To close an open file, use the ID number in the first column:

Net file 1 /close


Net Print

This command is used to give you information on a specific printer queue or print job. It can also control print jobs. 

To see print job information:

Net print \\home

To see the print queue of your laser printer:

Net print \\home\Laser1

To see information about a specific print job:

Net print \\home 20

To pause a print job:

Net print \\home 20 /hold

To stop a print job:

Net print \\home 20 /release