Windows IT Pro is the authoritative and independent resource for windows nt, windows 2000, windows 2003, windows xp. Features a collection of resources and magazines for windows IT professionals.
  
  
  Advanced Search 


November 1997

NET Commands


RSS
Subscribe to Windows IT Pro | See More Systems Administration Articles Here | Reprints | Or get the Monthly Online Pass—only $5.95 a month!

Automate and simplify network and administrative tasks

The NET commands in Windows NT are a set of networking and administrative commands that are useful to the administrator and of interest to the beginner investigating how NT works. With an understanding of the NET commands, you can simplify NT systems maintenance, especially when you use them in batch files. In this article, I'll show some of the more useful NET commands and suggest uses for them.

What Are the NET Commands?
You run the NET commands from a command prompt or from within a batch file, and they perform network and administrative tasks. Typical tasks include establishing network connections, adding users and computers to a domain, and starting and stopping network services.

One of the first uses that most people find for the NET command is during an over-the-network installation of NT or some other software. Typically, you connect to the server using the DOS client software and establish a connection to the server. Then you use the NET USE command to map a network drive that contains the source files for your new operating system. If you've created a share called i386 that has the source code, the syntax is

net use M: \\server\i386

to map the shared i386 directory on the server to the M: drive on the local computer. The next step is to switch to the M: drive and run the install or setup program.

Where Can I Find a List of NET Commands?
The first place to look for a list of NET commands is the command prompt from which you will run them. Type

net /?

to show the list of commands in Screen 1, page 214. To get more detailed help for a specific command, type

net help <command>

For example, to learn the correct syntax for the NET COMPUTER command, type

net help computer

A second place to look for a list of these commands is Windows NT Help--not Books Online, just the ordinary Help option on the Start menu. Choose the Find tab in the Help dialog box, and search on "net." Display the topic Commands Index for a listing similar to Screen 2, page 214. Be sure to search on net in lowercase, because you will see a different set of topics if you search on "Net."

Network Connections
As I mentioned earlier, you map a network drive with the NET USE command. You can put such a command into a logon script, ensuring that all users connect to the server with the same drive letter--something many network applications require. On its own, NET USE will list your existing connections. Follow the command with /del or /delete to drop the connection or /Persistent:yes to ensure that the connection is rebuilt when you log on again.

You can do the same thing with printers when you have DOS or Windows 3.1 programs that do not recognize network printers. The syntax is similar, except that this time, you use

net use lpt2: \\server1\HPLJ5

to map the network printer to a printer port that the DOS program understands. Now your DOS program can send its output to LPT2 and not even realize that it is talking to a network printer.

User and Group Accounts
You can add users and groups to a domain using NET commands. The NET USER command adds usernames, passwords, and other settings to the accounts database. The NET GROUP command adds global groups, and NET LOCAL GROUP adds local groups.

You can even add users to the groups you create and obtain lists of group memberships. In fact, you can use this feature to move users from one domain to another. (If you've worked with NT, you know that to migrate users from one domain to another, there is no easy way short of deleting thousands of users from one domain and entering them again in another domain.) NET USER lets you add users and, when you use it with no parameters, provides a list of users. The same rule applies to NET LOCALGROUP and NET GROUP. Suppose that you want to move everyone in the Engineering global group to another domain. The procedure is

1. Run the NET GROUP Engineering command to get a list of users, as Screen 3 shows.

2. Redirect this listing to a text file.

net group engineering >eng.txt

3. Using your favorite word processor, reformat the information to a batch file that contains the NET USE commands to add these users to the new domain. The batch file needs to contain one line per user and looks like:

net user <name> [password] /add/domain

4. Reformat the batch file to also contain the NET GROUP command to add the users to the Engineering group. This batch file needs to contain a line

net group engineering /add <name>

for each user, but you can put multiple names on one line if you want.

5. Run the batch files on the new domain.

   Previous  [1]  2  Next 


Top Viewed ArticlesView all articles
CES 2009: Ballmer Announces Windows 7, Windows Live, Live Search Milestones

During his first-ever Consumer Electronics Show (CES) 2009 keynote address last night in Las Vegas, Microsoft CEO Steve Ballmer announced the pending public availability of a feature-complete Windows 7, the final version of Windows Live Essentials, and ...

Command Prompt Tricks

One reader shares his tip for setting up the command prompt to reflect a remote path. ...

Where is Microsoft NetMeeting in Windows XP?

...


Windows OSs Whitepapers Why SaaS is the Right Solution for Log Management

Related Events Virtualization Forum: Optimizing Storage, Networks, Desktops, and Security

Cloud Computing Forum: Integrating Software, Server and Storage as a Service into Your Enterprise IT Delivery Model

Virtualization Forum: Optimizing Storage, Networks, Desktops, and Security

Check out our list of Free Email Newsletters!

Windows OSs eBooks Understanding and Leveraging Code Signing Technologies

A Guide to Windows Certification and Public Keys

SQL Server Administration for Oracle DBAs

Related Windows OSs Resources Become a VIP member of the Windows IT Pro community!
Get it all with the VIP CD and VIP access. A $500+ value for only $279!

Subscribe to Windows IT Pro!
Solve your toughest technical problems with our experts and access 10,000 + articles online. 30% off

Monthly Online Pass - Only $5.95!
Get instant access to 10,000+ articles from Windows IT Pro Magazine!

TechNet Virtual Labs
Evaluate and test Microsoft's newest products.


Windows IT Pro Home Register FAQ for Windows WinInfo News
Europe Edition About Us Contact Us/Customer Service Media Kit Affiliates / Licensing  
SQL Server Magazine Office & SharePoint Pro Windows Dev Pro IT Job Hound ITTV
IT Library Technology Resource Directory Connected Home Windows Excavator Windows SuperSite 
 
 Windows IT Pro is a Division of Penton Media Inc.
 Copyright © 2009 Penton Media, Inc., All rights reserved. Terms and Use | Privacy Statement | Reprints and Licensing