• No results found

with the NET Command on a Domain

12.12 Activity: Using the NET USE Command

Note 1: This activity is based on a specific computer network. Your own environ-ment will be significantly different.

Note 2: Be sure and check with your instructor and/or lab technician before at-tempting to use NET USE in a lab environment.

1 Go to the DELL-CZG computer running Windows 2000 Professional. Open My Computer. Right-click Drive C. Click Sharing. In the Share name drop down list box, select Dell-czg-C. Click Remove Share. Click OK.

2 Go to the DELL-FP computer running Windows Me. Open My Computer. Right-click Drive C. Click Sharing. Click Shared As. In the Share Name, key in DELL-FP-C. Click OK.

3 Return to the Micron-PC computer. Open My Network Places. Click View Workgroup Computers. Double-click DELL 8100 (DELL-FP).

12.12 ACTIVITY: USING THE NET USE COMMAND

You have set up your environment for this activity. No drives or devices are shared on the DELL-CZG (Windows 2000 Professional) computer. The printer and drive C are shared on the DELL-FP (Windows Me) computer.

4 Close the Dell 8100 (Dell-FP) windows. Open a Command Prompt window.

5 Key in the following: C:\>NET USE e 6 Key in the following: C:\>NET VIEW e

C:\>NET USE

New connections will be remembered.

There are no entries in the list.

C:\>NET VIEW

Server Name Remark

---\\DELL-CZG

\\DELL-FP DELL 8100

\\MICRON-PC

The command completed successfully.

C:\>

Since you have mapped no drives, you see no entries in the list. You must first map a drive in order to see any entries and the drive must be shared. You must select a drive letter that is not an actual physical drive on your system. The NET VIEW command allows you to see.

7 Key in the following: C:\>NET USE T: \\DELL-FP\DELL-FP-C e 8 Key in the following: C:\>NET USE T: e

679

You see confirmation that the command worked. Then when you used the NET USE command without parameters, the line at the top indicated that New connections will be remembered. It is important to note that drive alias assigned with the NET USE command may or may not be “persistent,” meaning that the connections created may or may not remain in effect after shutting down the com-puter. In this example, the persistent state is on. If you were on a domain network or a peer to peer, and had mapped R to a drive, and you keyed in the following series of commands:

NET USE /PERSISTENT:NO NET USE R: /D

NET USE

Your results would look like Figure 12.11.

C:\>NET USE /PERSISTENT:NO

Figure 12.11—Use of Persistent on a Domain Server

12.12 ACTIVITY: USING THE NET USE COMMAND

In Figure 12.11, notice the line New connections will not be remembered. at the top of the display following the NET USE command. The persistent state is now off. It is important to know the persistent state before issuing a NET USE connection so you are aware if the command will be permanent or temporary, or so you can force it to be with the /YES or /NO parameter. Remember, the persistent state will remain in effect.

All commands issued will have the same state as the previous command. It is a “from this point forward” parameter.

9 Minimize the Command Prompt window. Open My Computer.

You can see the new T drive. The drive icon under for Drive T has a cable. This indicates that this drive is not on the local computer, but is available across the network.

10 Close My Computer and restore the Command Prompt window.

11 Key in the following: C:\>T: e 12 Key in the following: T:\>DIR e

C:\>T:

T:\>DIR

Volume in drive T has no label.

Volume Serial Number is 07D1-080E Directory of T:\

08/14/2001 01:01 PM <DIR> WINDOWS 10/13/2001 03:04 PM 0 CONFIG.BAK 08/14/2001 01:01 PM <DIR> _RESTORE 10/13/2001 03:01 PM <DIR> TEMP 08/14/2001 01:06 PM <DIR> DELL 10/17/2001 09:57 AM <DIR> ACT-DISK 10/13/2001 03:04 PM 246 AUTOEXEC.BAK 05/20/2002 07:24 PM <DIR> BOOK

681

As you can see, you can access a mapped drive from the Command Prompt window just as if it was a local drive. Drive C, on the DELL-FP, running Windows Me, was shared. Because it was shared, it could be mapped using NET USE.

The system cannot find the path specified.

C:\>

You have successfully disconnected the drive mapping of T: to

\\DELL-FP\DELL-FP-C. However, what if a drive is not shared? If for instance, you had one computer downstairs that you were working on and you needed to access a file on a computer upstairs and you had not shared the drive on the upstairs com-puter, you could still access that computer if you were running Windows 2000 Professional or above, by using the Administrative share to access that upstairs drive.

Again, the Administrative share is shared by default. If a user turned off sharing of that Administrative share, you could not access using the driveletter$.

16 C:\>DIR \\DELL-CZG\C$ /P e

Volume in drive \\DELL-CZG\C$ has no label.

Volume Serial Number is 07D1-080F Directory of \\DELL-CZG\C$

12.12 ACTIVITY: USING THE NET USE COMMAND

08/15/2001 12:12 AM <DIR> I386

Even though you did not share Drive C on the DELL-CZG (running Windows 2000 Professional), you were still able to access it using the Administrative share. It is much more convenient to place drive mapping commands batch files and place short-cuts to the batch files on the desktop.

17 Place the DATA disk in the A drive. Change the default to Drive A.

18 Key in the following: A:\>MD CHAP12 e 19 Key in the following: A:\>CD CHAP12 e

20 Using the Command Line editor, create the following two batch files (MAP-T.BAT and UNMAP-T) in the CHAP12 subdirectory on the DATA disk.

MAP-T.BAT UNMAP-T.BAT

@ECHO OFF @ECHO OFF

NET USE T: \\DELL-FP\DELL-FP-C NET USE T: /DELETE

PAUSE PAUSE

21 Minimize the Command Prompt window. Open My Computer. Open Drive A.

Open CHAP12. Select both MAP-T.BAT and UNMAP-T.BAT. Right-drag them to the desktop. Click Create shortcuts here.

683

You now have shortcut icons to both MAP and UNMAP-T on the desktop.

22 Double-click the Shortcut to MAP-T.BAT icon.

You get the message that the command was successfully completed.

The Command Prompt window has not closed, as there is a PAUSE command holding the batch file for user intervention. If not for the PAUSE command, the window would close immediately. If there had been a problem with the mapping, you would have no opportunity to view any error message.

23 Press any key in the Command Prompt window. Open My Computer.

The batch file finishes, and the command prompt window closes.

Then, when you opened My Computer window, you see that Drive T is available.

12.12 ACTIVITY: USING THE NET USE COMMAND

24 Close My Computer. Restore the Command Prompt window and key in the following: C:\>NET USE e

C:\>NET USE

New connections will be remembered.

Status Local Remote Network

---OK T: \\DELL-FP\DELL-FP-C Microsoft Windows Network

The command completed successfully.

C:\>

The NET USE command registers the drive mapping of T.

25 Minimize the Command Prompt window. Double-click the Shortcut to the UNMAP-T.BAT icon. Press the space bar when you see the message that the command was successful.

26 Restore the Command Prompt window. Key in the following:

C:\>NET USE e

C:\>NET USE

New connections will be remembered.

There are no entries in the list.

C:\>

The batch file window closed. When you restored the Command Prompt window and used NET USE, you saw that drive T is no longer available.

There are endless combinations of useful ways to use drive letter mappings to shared devices. If you have a graphic package with two CDs, you could place one in each computer, map a drive letter to the second computer, and be able to access them quickly without switching disks. You can make backups of critical data “on the fly”

by mapping a letter to a subdirectory on the remote computer, and doing a second save to the remote drive. Each situation is different, and only you know the optimum method for your system.

The ability to map drives is especially useful on domain networks. For instance, Figure 12.12 shows the result of a NET USE command on a Domain based network.

685

In this example, the connections made to the Network are listed here, including the results of a print command. \\busdiv is the name of the Domain server. Different drive letters are assigned to particular subdirectories on the server. If you then keyed in the command NET USE LPT1 /D, you would delete the connection to the printer, LPT1. If you then keyed in the command NET USE R: \\BUSDIV\USER\BPEAT

\GRAPHICS, you are assigning the drive letter R to the named subdirectory on the server. Then, using NET USE would show you the results of these commands which is shown in Figure 12.13.

Figure 12.13—Using NET USE on a Domain

Here, in this example, there is a difference in the R: drive name as compared to the other drive names. The R: drive name was assigned by the user, not by the

Adminis-12.12 ACTIVITY: USING THE NET USE COMMAND

trator on the network server. The drive name, however, is valid. Keying in R: will result in and actual change of default drives. This is a valuable tool to use when you, as a user, store your data on a network drive, sometimes many, many directory levels deep, and wish to have a single drive letter to be able access that subdirectory. In this way, when accessing those files you do not have to key in a long drive specification, such as G:\DATA\2002\CIS55\GRAPHICS\filename, but can instead use simply R:\filename. The NET USE command does not distinguish the type of network. It simply reports the network connections in use.

27 Close all open windows. Delete the shortcuts to the MAP-T.BAT and UNMAP-T.Bat on the desktop.

You have returned to the desktop.

12.13 Mapping Drives Using Windows

Related documents