I've often been ridiculed by other administrators for excessively using the
command line in a graphical environment such as Windows. However, Windows NT
Server and Windows 2000 Server provide an extended set of commands that can be
effectively used in batch files to automate network-related tasks. One such
command is the Net command. In this article, I'll show how you can use the Net
command, and I'll explain the syntax behind its various options.
What is the Net command?
Before you can understand what the Net command is, you must understand a
little bit about the way networks used to work. In the days of DOS and Windows
3.1 (not Windows for Workgroups), Windows had very little built-in network
support. The majority of the network functions had to be performed at the DOS
level. A typical process was to load the network redirector through the
Autoexec.bat file. Once the redirector was loaded, the user could interact with
the network. This is where the Net command came into play. The Net command was
basically a single command that could be used to accomplish a wide variety of
network-related tasks, such as logging in or mapping a network drive.
Over the years, the Net command has become obsolete for anything other than
automation purposes. Almost every task that can be performed through the Net
command can also be accomplished through the graphical user interface (GUI). In
spite of this fact, the Net command has evolved over the years. Extra
functionality has been added to the command, and it's still supported to this
day.
Now that you know the history of the Net command and some of its uses, let's
examine the command in detail. In the sections that follow, I'll discuss each
of the Net command's functions. The Net command is always a two-part command.
The Net commands you can issue include the following:
- Net Accounts
- Net Computer
- Net Config
- Net Continue
- Net File
- Net Group
- Net Help
- Net Helpmsg
- Net Localgroup
- Net Name
- Net Pause
- Net Print
- Net Send
- Net Session
- Net Share
- Net Start
- Net Statistics
- Net Stop
- Net Time
- Net Use
- Net User
- Net View
Net Accounts
The Net Accounts command provides a method for displaying the account
policies for the domain. You can see a sample of the Net Accounts command here.
Net Computer
The Net Computer command allows you to add a computer account to or remove
a computer account from a domain. What's cool about this command is that if you
have a list of computer account names, you can write a simple batch file to add
or remove those account names. You can see a sample of the Net Computer
command's functionality here.
Net Config
Many times, when I've been working on someone else's computer, I've needed
to know the basic settings, such as the computer name, the workgroup name, and
the name of the user who's logged in. The Net Config command provides a quick
and easy way to acquire this information. In a Windows 98 or Windows Me
environment, the Net Config command displays the type of information shown
below:
C:\WINDOWS>net config
Computer name \\TAZ
User name ADMINISTRATOR
Workgroup BUD
Workstation root directory C:\WINDOWS
Software version 4.90.3000
Redirector version 4.00
The command was completed successfully.
The Net Config command also works in Windows NT. The main difference is that
you have to specify whether you want to display a summary of a server or a
workstation. For example, if you entered net config workstation, you'd
see a summary similar to the one given in Windows Me but with slightly more
detail.
Net Continue
You use the Net Continue command to restart a service that has been paused
by a Net Pause command. The syntax for the command is
C:\Windows>net continue service
where service is the name of the service you paused.
Net File
Need to find out who's using files on your server? Just use the Net File
command. As you can see here, the Net File command provides you with a quick summary
of which users are attached and how many files they have locked.
Net Group
The Net Group command allows you to display all of the groups that exist
within a domain. You can see a sample of this command here.
Net Help
The Net Help command gives you detailed information on a Net command. To
use it, just type net help command, where command is the name of
the command you want help with.
Net Helpmsg
If Windows 2000 has a problem, it often coughs up confusing error messages
and numbers. You can use the Net Helpmsg command to try to find out what the
error messages mean. Just type Net Helpmsg errornumber, where errornumber
is the error that Windows 2000 has given you.
Net Localgroup
Just as the Net Group command displays all of the domain's groups, the Net Localgroup
command displays a list of the groups that are specific to the local computer.
Here's a sample of the Net Localgroup command.
Net Name
You can use the Net Name command to control the name of the server when it
sends and receives messages online. If you use the command by itself, you can
see the current names configured for your computer. You can add or delete names
by using the /ADD and /DELETE switches, respectively.
Net Pause
The Net Pause command pauses services running on your server. It can be
useful if you need to pause a service to troubleshoot or make changes to it. To
use it, just type Net Pause service, where service is the name of
the service you want to pause.
Net Print
I can't count the number of times I've needed to add printing capabilities
to a batch file. In older versions of Windows, network printing from a batch
file usually meant using the Net Use command to capture a printer port and then
printing to the captured port. Unfortunately, this technique can cause
confusion for end users the next time they try to print because they may have
already been using the printer port that the batch file reassigned. If your
users are working in a Windows 98, Me, or NT environment, the Net Print command
is a good alternative to traditional batch-file printing. The Net Print command
allows you to send print jobs to a network printer without capturing an LPT
port. You can see the syntax for the Net Print command here.
Net Send
You can use the Net Send command to send a pop-up message to network users.
Just enter the username and the message. As you can see in this sample, the command also offers the capability to send
messages to users in another domain.
Net Session
The Net command can even be used to see which computers are attached to your
computer. Simply enter the Net Session command, and you'll see a summary,
similar to this one.
Net Share
If you'd like to see which shares exist on a PC, you can do so by using the
Net Share command. You can see a sample of this command here.
Net Start
This command starts any of the various services that are running. You can
use the Net Pause or Net Continue command to pause or resume services.
Net Statistics
Perhaps one of the most useful Net commands is Net Statistics. The Net
Statistics command provides some hard-core statistics on how a server or
workstation is communicating across the network. This command merely requires
you to follow the Net Statistics command with the word Server or Workstation,
as shown here.
Net Stop
This command is the opposite of Net Start. As you can probably guess, it
stops services from running on your server.
Net Time
One of the commands I've found very useful is the Net Time command. The Net
Time command is used to synchronize the time on a workstation with the time on
a server. Here's the syntax for the Net Time command:
net time [\\computer | /WORKGROUP:wgname] [/SET] [/YES]
- computerSpecifies the name
of the computer (time server) whose time you want to check or synchronize
your computer's clock with
- /WORKGROUPSpecifies that you
want to use the clock on a computer (time server) in another workgroup
- wgnameSpecifies the name of
the workgroup containing a computer whose clock you want to check or
synchronize your computer's clock with; if there are multiple time servers
in that workgroup, Net Time uses the first one it finds
- /SETSynchronizes your
computer's clock with the clock on the computer or workgroup you specify
- /YESCarries out the Net Time
command without first prompting you to provide information or confirm
actions
Net Use
Without a doubt, the most powerful Net command in any version of Windows is
the Net Use command. This command lets you attach to resources such as network
shares or printers. For example, to map the Q: drive to a share called Articles
on a server called Tazmania, you could enter the following command:
net use Q: \\Tazmania\Articles
Likewise, you could map LPT1 to a network printer that's attached to a server
called Scooby and shared as HP by entering the following command:
net use LPT1: \\Scooby\HP
The Net Use command also provides mechanisms for removing connections that
you've made and for entering passwords. Here's a full summary of the Net Use syntax.
To list all of your connections, type Net Use without options. To see
this information one screen at a time, type the following at the command
prompt:
net use /? | MORE
or
net help use | MORE
Net User
Another use for the Net command is viewing all of the user accounts that exist on
a given machine. To do so, simply enter the Net User command, as shown here.
Net View
This command displays the other computers that are visible on the network. You
can see a sample of Net View's output here.
If you wish to get more information, please email us at

or call us at (714) 228-5444