\[Editor's Note: Share your Windows 2000 and Windows NT discoveries, comments, problems, solutions, and experiences with products and reach out to other Windows 2000 Magazine readers (including Microsoft). Email your contributions (400 words or less) to email@example.com. Please include your phone number. We edit submissions for style, grammar, and length. If we print your submission, you'll get $100.\]
Who's Hogging the Disk Space?
I administer a Windows NT Server 4.0 Web server running Microsoft IIS 4.0. I manage 70 Web-page maintainers, and each has an assigned folder to which the maintainer can upload Web pages. To keep an eye on the total size of these folders, I use the Microsoft Windows NT Server 4.0 Resource Kit Diruse tool. For example, all the maintainers' folders are in the G:\wwwroot\pagemaintainers directory. To find out the folders' size, I use the following syntax:
where /* shows the top-level folders, /m displays the folder size in megabytes, and /s includes the subfolders in the total. I run this command at a command prompt on the Web server.
I direct the command's output to a text file called spacehogs.txt. I can open this file in Microsoft Excel and arrange the results to my preference.
Logon Scripts Almost Work
With the advent of Windows Script Host (WSH), our organization decided to replace our logon command files with equivalent VBScript. Fundamental to any logon script is the ability to obtain the username of the user who is logging on. To our dismay, this feature failed to work in VBScript on our workstations. The first user to log on after booting received the error message 0x800704DD - Username not available when the system ran the script.
We realized that timing was the cause of this problem. The logon process executes in parallel to the script, so a problem arose when the script requested the username too early. As a solution, we set the script to loop until the username becomes available, as the following script example shows:
'Pause script until User is logged in
UserName = ""
On Error Resume Next
UserName = WshNetwork.UserName
Loop Until UserName <> ""
On Error Goto 0
Backup Netscape Bookmarks
Several users at my company have lost their Netscape Navigator bookmarks as a result of machine crashes. I don't perform local backups of workstations, so I was stumped about how to back up just the bookmark.htm file without copying the entire Users folder.
I finally discovered a solution—use the attrib command. I set the archive attribute for all files in the Netscape Users folder to off, and I set the attribute to on for the files that I wanted the system to back up (i.e., users' bookmarks). The batch file in Listing 1 runs as a logon script, so only 1 day's worth of changes to users' bookmarks is lost if their system crashes. You can apply the batch file to any set of files that you need to regularly back up, and set the copy location to your preference. I use the \profiles directory.
Automatic Printer Installation Script
A large department migration at my company prompted the need to develop many timesaving routines. To speed the printer installations on client workstations, I developed the batch file that Listing 2, page 28, shows and the KiXtart script that Listing 3, page 28, shows. By automatically connecting server-based printers, these scripts eliminate the need to manually install and configure individual printers. You place the two files, printers.bat and printers.kix, in the domains' Netlogon share, and you run them from a logon script or manually. In Listing 3, server is the network name of the Windows NT server hosting the printers. I used an If ingroup command to install printers for specific groups.
A Case for Maintaining Updated Firmware
Recently, a client called me for help about how to recover a server after a software installation went terribly wrong and caused the system to crash. The client had attempted to use the Windows NT Support Software Diskette (SSD), which is available on Compaq's Web site, to install the Compaq Array Configuration utility. The installation required my client to upgrade the Compaq SMART Array 221 Controller. The client finished the installation and rebooted the server. The result was a blue screen.
The cause of the problem was cpqarray.sys from NT SSD 2.12C or later on an array controller with firmware 2.08 or earlier. The blue screen resulted because cpqarray.sys couldn't find the SMART array controller. To solve the problem, I applied the latest firmware update for the Compaq SMART Array 221 Controller. My client could have avoided the whole incident by maintaining updated firmware.
Extract Email Addresses to a Text File
In Outlook VBA on Demand: "Showing the Sender's Email Address" (June 2000), Sue Mosher explains how to display a sender's full email address on a message in your Inbox folder. I've been looking for code that provides this functionality because I was frustrated that Microsoft Outlook only provided the display name from a message rather than the email address.
However, my goal is slightly different from Sue's goal in the article. I want to extract several email addresses from a folder and write the addresses to a text file. I used the helpful code from the article as well as Microsoft Exchange Server scripting to enable this functionality on my system. To extract email addresses for a Web-based bulk email sender, I used the script that Listing 4, page 28, shows.
My first disappointment with Windows 2000 was the number of double-clicks the OS required to navigate to administrative utilities that I had easily accessed through Windows NT 4.0's Start menu. Then, I discovered that you can customize Win2K's Start menu to make the process easier. To do so, right-click the taskbar, and select Properties. On the Advanced tab of the Properties window, select the Display Administrative Tools check box in the Start Menu Settings section. On this tab, you can also click Re-sort, which alphabetizes your Start menu after you make a change.
Ntbackup at a Command Prompt
Some administrators believe that you can't use Ntbackup from a command line to back up one file on a Windows NT system. However, this feat is possible using the archive file attribute and Ntbackup's incremental backup facility. To do so, use the following process:
- Use the Attrib command to remove the archive attribute from all files in the directory that contain the file you want to back up. (If the directory includes subdirectories, use the /S switch in addition to the Attrib command.)
- Use the Attrib command again to set the archive attribute on the target file.
- Use the Ntbackup command with the /t incremental switch to back up the directory.
I've never tried this method on a Windows 2000 system, but Win2K retained the incremental backup facility. Thus, you could adapt this method for Win2K.