Networking / Beginners

Net Commands

Among the more useful commands for network administrators are the Net Services commands. These commands are all two-word commands, beginning with Net - such as Net Use and Net Start. In the following sections, present each of the Net commands, in alphabetical order for handy reference. First, point out a few details about the Net commands:

  • You can get a quick list of the available Net commands by typing net /? at a command prompt.
  • You can get brief help for any Net command by typing net help command. For example, to display help for the Net Use command, type net help use. (Yes, we all could use some help.)
  • Many of the Net commands prompt you for confirmation before completing an operation. For these commands, you can specify /Y or /N to bypass the confirmation prompt. You'll want to do that if you include these commands in a batch file that runs unattended. Note that you can use /Y or /N on any Net command, even if it doesn't prompt you for confirmation. So I suggest that you place /Y on every Net command in a batch file that you intend on running unattended.

The Net Accounts command

This command updates user account policies for password requirements. Here's the command syntax:

net accounts [/forcelogoff:{minutes | no}]
    [/minpwlen:length] [/maxpwage:{days | unlimited}]
    [/minpwage:days] [/uniquepw:number]
    [/domain]

The following paragraphs describe the parameters for the Net Accounts command:

  • Forcelogoff: Specifies how long to wait before forcing a user off the system when the user's logon time expires. The default value, no, prevents users from being forced to log off. If you specify a number, the user will be warned a few minutes before being forcibly logged off.
  • Minpwlen: Specifies the minimum length for the user's password. Length can be from 0 through 127. The default is 6.
  • Maxpwage: Specifies the number of days a user's password is considered valid. Unlimited means the password will never expire. Days can be from 1 through 49,710, which is about 135 years. The default is 90.
  • Minpwage: Specifies the minimum number of days after a user changes a password before the user can change it again. The default value is 0. You should usually set this value to 1 day in order to prevent users from bypassing the Uniquepw policy.
  • Uniquepw: Indicates how many different passwords the user must use before he or she is allowed to reuse the same password again. The default setting is 5. The range is from 0 to 24.
  • Domain: Specifies that the operation should be performed on the primary domain controller rather than on the local computer.

If you enter Net Accounts without any parameters, the command simply displays the current policy settings.

Here's an example that sets the minimum and maximum password ages:

C:\>net accounts /minpwage:7 /maxpwage:30

The Net Computer command

This command creates or deletes a computer account. Here's the syntax:

net computer \\computername {/add | /del}

The following paragraphs describe the parameters for the Net Computer command:

  • Computername: The name of the computer to add or delete.
  • Add: Creates a computer account for the specified computer.
  • Del: Deletes the specified computer account.

Here's an example that adds a computer named Theodore:

C:\>net computer \\theodore /add

The Net Config command

This command lets you view or configure various network services. Here's the syntax:

net config [{server|workstation}]

To configure server settings, use this syntax:

net config server [/autodisconnect:time]
    [/srvcomment:"text"] [/hidden:{yes | no}]

The following paragraphs describe the parameters for the Net Config command:

  • Server: Lets you display and configure the Server service while it's running.
  • Workstation: Lets you display and configure the Workstation service while it's running.
  • Autodisconnect: Specifies how long a user's session can be inactive before it's disconnected. Specify -1 to never disconnect. The range is -1 to 65535 minutes, which is about 45 days. The default is 15 minutes.
  • Srvcomment: Specifies a description of the server. The comment can be up to 48 characters long and should be enclosed in quotation marks.
  • Hidden: Specifies whether the server appears in screens that display available servers. Hiding a server doesn't make the server unavailable; it just means that the user will have to know the name of the server in order to access it. The default is No.

Here's an example that sets a server's descriptive comment:

C:\>net config server /srvcomment:"DHCP Server"

The Net Continue command

This command continues a service you've suspended with the Net Pause command. Here's the syntax:

net continue service

Here are some typical services that you can pause and continue.

  • Netlogon: The Net Logon service.
  • Schedule: The Task Scheduler service.
  • Server: The Server service.
  • Workstation: The Workstation service.

Here's an example that continues the Workstation service:

C:>net continue workstation

If the service name has embedded spaces, enclose the service name in quotation marks. For example, this command continues the NT LM Security Support Provider service:

C:\>net continue "nt lm security support provider"
[Previous] [Contents] [Next]