Skip navigation

Reader to Reader - June 1998

A Trick of the NT Trade

I love finding tricks to make my job as an administrator easier. Here's a trick to work around a Windows NT quirk.

NT doesn't let you map a drive letter to a share's subdirectory. This quirk is especially annoying in home directories, where users can use Windows Explorer to view other users' directories. A great workaround is to use the SUBST command to map the drive. SUBST lets you use Uniform Naming Convention (UNC) paths and environment variables in the command line. You just add the following command to the logon script:

SUBST h: \\logonserver\users\%username%

This command tells NT to map the H drive to the directory under the user's share that matches the name of the user logging on.

Upgrading to NT Server over SP3
I was running Windows NT Workstation 4.0 Service Pack 3 (SP3) but wanted to experiment with NT Server functionality on that machine. Ordinarily, I perform operating system (OS) installs to clean directories. However, I decided to try a workstation upgrade because I wanted to avoid reconfiguring the system and reinstalling applications.

After ensuring that I had a current backup, I installed NT Server and selected the options to upgrade the existing workstation installation. The post-installation boot process went smoothly until it tried to load the GUI. The logon screen flashed briefly just before the blue screen of death appeared. Not surprisingly, most of the files listed on the blue screen were drivers, and most of these were networking specific.

I booted to DOS (my system is on a FAT partition so that I can rescue my-self during these experiments) and then brought up the systemdir\system32\drivers directory. Most of the time stamps said May 1997--definitely not the upgraded NT installation files. I hypothesized that the installation failed to overwrite newer service pack files and that the resulting hybrid had incompatibilities. However, because the post-installation boot process had reached the GUI, I was hopeful that I could fix the problem.

I performed a basic installation of NT Server to a clean directory, then copied the entire system32\drivers directory from the clean install to the upgrade. (Copying the entire directory was faster than copying only the problematic drivers.)

I rebooted to the upgraded version, successfully logged on, and immediately applied SP3. I then performed a backup to a clean tape and archived the pre-upgrade tape. The system has been running fine since the fix, so I haven't had to use the tapes.

Have More Time to Send New Messages
If you frequently use the Microsoft Windows Messaging email client, you can set up a shortcut on your desktop that will take you directly to the New Message screen. This shortcut involves seven steps:

1. Right-click on the desktop background.

2.Select New, Shortcut.

3. Specify the following command line (assuming that you installed Windows Messaging in the default location):

c:\program files\windows nt\windowsmessaging\exchng32.exe /n

4. Click Next.

5. Type

Send new email

6. Click Finish.

7. Click the new icon to generate a new mail message.

In step 3, the /n switch specifies that the shortcut icon will display the New Message screen. You can change the switch to /i to display the Inbox or /a to view the Address Book. You can replace the /n with a filename so that the shortcut icon will open a new message with the specified file already attached.

Determine Users' Disk Space Consumption
I used KiXtart 95 to create a logon script that finds out how much disk space each user is consuming. (KiXtart 95 is a logon script processor and enhanced batch language for Windows NT and Windows 95 workstations. For more information about KiXtart 95, go to http://www.xs4all.nl/~akhw/winnt.htm.) I run the logon script only when my Primary Domain Controller (PDC) is available and when the connection isn't through Remote Access Service (RAS).

I use the AT command with a batch file in NT server to collect data every 12 hours. In the batch file, I use the DiskUse utility (in the Microsoft Windows NT Server 4.0 Resource Kit, Supplement Two) with these parameters:

diskuse <main directory of data> /f:<directory in the server to store the logs>\disk.log /s /t /q

The resulting file, disk.log, will list the domain name, user ID, and total amount of disk space that each user consumes. After I have this information, I can use it in the logon script in the routine in Listing 1. A DO loop in this routine checks the disk.log file for each user ID and retrieves the amount of disk place for each user ID.

I use the information that the logon script obtains to generate a message that tells users when they've exceeded the size allowed. If you want to generate such a message, you need to add the routine in Listing 2 to the logon script. This routine calls on an event log, LogonLog, during the script's execution. The $UDSIZE variable is the total amount of disk space allowed per user. I obtain this variable with the routine in Listing 3. I use the System Policy Editor (SPE) to maintain the $UDSIZE information.

Installing and Configuring Drive Letters
When people install Iomega's Zip or Jaz drive in Windows NT 4.0, they sometimes run into the problem of not being able to change the logical drive letter. This problem occurs because of the way in which NT assigns drive letters: NT first assigns drive letters to physical devices and then assigns drive letters to logical partitions and subdivisions. Thus, the Zip or Jaz drive receives a drive letter fairly early, preventing you from changing it later.

I found many inaccurate suggestions on how to correct this problem in the Iomega section of America Online and on the Internet, so here's how to correctly solve the problem. I have successfully used a procedure that is based on personal experience and Microsoft's Knowledge Base article "Cannot Change the Drive Letter of Removable Drives" (http://support.microsoft.com/support/kb/articles/q142/6/35.asp).

My procedure assumes you have downloaded and unzipped the Iomega archive into C:\ZIPDRIVER. (The driver and Zip tools are available to download at ftp://147.178.1.54/pub/iomgnt15.exe.) You then follow six steps.

1. Open Disk Administrator. In the Start menu, select Programs, then Administrative Tools (Common), and finally Disk Administrator.

2. Change your CD-ROM drive to a high letter (i.e., Q or Z). Right-click CD-ROM, and select Assign drive letter. After selecting the drive letter, click OK. Screen 1 shows the results. Close Disk Administrator.

3. Open SCSI Adapters. In the Start menu, select Settings and then Control Panel. Double-click on SCSI Adapters.

4. Add the driver. Click the Drivers tab, then Add, and finally Have Disk. Select the path request C:\ZIPDRIVER\PARALLEL, and click Open. Click OK. Close SCSI Adapters.

5. Check results. Shut down your machine, connect the Zip drive, and reboot. Make sure that none of your existing drive letters have changed in Disk Administrator.

6. Install the Zip tools. These tools are in the root of C:\ZIPDRIVER.

If you have already installed the driver and just need to change the drive letter, use only step 1 through step 3.

Use Spare Disk Capacity for Online Backups
The small office where I work uses Windows NT Server 4.0 with a few workstations attached. The office consists of mostly Ada programmers who modify small text files and flowcharts. Even the libraries and executables they produce are not very large. On average, each programmer uses about 5MB per day, which usually uses less than 3MB in a compressed directory.

I wanted to make daily backups so that I could retrieve files that programmers accidentally corrupted or deleted. Because of the small amount of hard disk space involved, I couldn't justify purchasing a third-party backup utility or using the standard tape backup method. (Using tapes for backups is fine if you need the capacity tapes offer.)

Then I came up with the idea of using spare disk capacity for online backups. Although I had enough spare disk space to store the daily backups, NT didn't provide a means to use it. So I developed a method to make daily backups to disk. I use the NT Scheduler, two batch files, the xcopy command, and a simple program. This system is not only cost-effective, but lets me easily retrieve files. I use Explorer's Find Files or Folders utility to locate the file and then drag it to the appropriate directory.

I will describe how this backup method works and provide the source code on the Web. I wrote the utility in Ada, but it doesn't really matter what language you choose to write the program, as long as you use a language that lets you access the native Win32 API.

My office's server uses four logical disk structures: system (C drive), data (D drive), backup (E drive), and repository (F drive). Because the system and repository disks contain read-only data and data I can easily reproduce, I don't back up these disks daily. I back up only the data disk daily. I use the AT command to schedule the backup procedure to execute at 2 a.m.:

AT 02:00 /Every:M,T,W,Th,F,S,Su e:\DoBackup

DoBackup is a batch file that starts the backup method in which xcopy copies files that users have altered in the previous 24 hours to a compressed back-up disk in a folder named after the current date. (For example, the folder for December 9 is E:\09DEC97.) The DoBackup batch file is

@Echo Off

e:\Backup e:\BackupCmd.bat

The DoBackup batch file executes a program (Backup) and passes as a parameter the name of another batch file (BackupCmd). The Backup program is simple. It calls the Win32 API CreateProcess to create a new process to execute the BackupCmd batch file. The new process contains two variables: Date, which is set to the current date, and Since, which is set to the date of the day before the current date. The format of these two dates is not the same. The Date variable has the format ddmmyy because it creates the backup folder; the Since variable has the format mm-dd-yy because xcopy uses it. The BackupCmd batch file is:

e:\Xcopy d:\*.* e:\%Date% /q /d:%Since% /i /s /k /h

/Exclude:e:\ExclusionList.txt

The BackupCmd batch file tells xcopy to copy all the files that users have altered since the Since date to a folder named after current date on drive E. The exclusion list tells xcopy which files and directories it doesn't need to copy. In my the exclusion list, I exclude the directory D:\Recycler.

I have used this backup method for more than 8 months without problems. With this method, I can easily find and restore files because the backup doesn't use tapes. (However, I still make weekly disk-to-tape backups of the entire disk in case of complete disk failure.)

Tip Modified for Mixed NT-Novell Networks
Steve Hong's "Tip for NT Administrators" (October 1997) was great. He created a batch file that resets the username after an administrator logs on. This batch file works in a Windows NT-only environment, but my network operating system (NOS) is Novell intraNetWare.

I installed intraNetWare Client 4.1 for Windows NT on my NT client workstations because this client provides more logon options for the user than the Microsoft-supplied client provides. One such option, NT Logon Only, lets administrators log on to the workstation and bypass Novell authentication. This option is particularly useful if you want a quick logon or if the Novell server is unavailable.

When an administrator logs on to perform a task on a user's workstation, the user will not be able to log back on. This inability can result from changes in the NT logon username, user context, or Novell logon name. It can also result from the NT Logon Only option being enabled. To eliminate users' confusion and reduce the number of support calls, I modified Steve's batch file so that it modifies those parts of the Registry that apply to the Novell intraNetWare Client. This batch file will work on only NT Workstations using intraNetWare Client 4.1 (or later).

Listing 4, page 48, contains the batch file, which you can run from a command prompt or from the Start menu. You can use a logon script to copy the batch file into the c:\winnt\system directory so that the batch file will be available to users when they log on.

Hide comments

Comments

  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
Publish