Reader to Reader - October 1997

Tips for NT Administrators

\[Editor's note: Share your NT discoveries, comments, experiences with products, problems, and solutions and reach out to other Windows NT Magazine readers (including Microsoft). Email your contributions (under 400 words) to Karen Forster at [email protected] Please include your phone number. We will edit submissions for style, grammar, and length. If we print your letter, you'll get $100.\]

Has the following scenario happened to you? You log on to a user's Windows NT machine to perform some administrative tasks. Then you log off. Next, you get a follow-up tech support call because the user tried to log on but couldn't. The user forgot to change the username back to the user's logon.

I wrote a little batch file, which you see in Listing 1, to take care of this problem. Put this batch file into a public, shared area. Note the username when you log on to the user's computer. After logging on, enter

SETUSER <username>

from Program Manager, File Run in NT 3.51 (or Start, Run in NT 4.0). The batch file in Listing 1 changes the Registry entry pertaining to the last logged-on user.

Change the tmpfile to a local temporary file. Make sure regedit.exe is available in your path.

Windows NT Message of the Day
In UNIX, the message of the day is a standard option that you can easily modify and present to all users. Windows NT lacks an apparent method for constructing a message of the day that users can view. To address this shortcoming, I created the C program in Listing 2, and some Registry edits that let NT display a message of the day to selected users. The program msg.exe lets administrators present none, one, or two messages to a user. The messages appear on top of any open window, and the user must dismiss them.

The program is basic. The executable msg.exe resides in the system32 directory. When a user logs on to the NT workstation, the winlogon Registry entry HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\Userinit executes msg.exe. The msg.exe program wakes up and checks the message directory for two files: msg1.txt and msg2.txt. If msg1.txt exists, a bell rings slowly five times and then a notice appears on the screen, displaying the contents of the msg1.txt file. After the user dismisses the first message, msg.exe checks for the existence of a second file, msg2.txt, and displays its contents. If either message file is missing, the msg.exe program bypasses the notices.

To install this program, first decide where the message files will reside. Be sure the C file (ex. #define MESSAGE1 "c:\\message\\msg1.txt") reflects this information. Add the two message files to the appropriate directory. Compile the message program source, and put it in the system32 directory where the logon program can find it. Edit the Registry values in HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\WindowsNT\CurrentVersion\Winlogon\Userinit. Change the entry




Notice that I added the msg.exe program to the end of the string. After the edit is successful, log off and log back on to the system and test for results. A notice box will appear with the contents of the text file msg1.txt.

After the user logs on to the NT workstation, the system beeps five times and displays the first message of the day. After the user dismisses the first notice, the system beeps again and the second message appears. The program checks for the existence of the message files, and if they are unavailable, the program does not invoke a message of the day, effectively turning off the service.

A UNIX Snob's Opinion of NT
I am a big fan of UNIX and am keeping a wary eye on the Windows NT platform. If you ask me which OS I prefer, I will tell you UNIX, without hesitation. But I believe that competition is good for business, so I am enjoying the sight of the various UNIX vendors scrambling to lower prices and add features as NT encroaches on their turf.

I spend my day in front of a Silicon Graphics machine (which has one of the finest desktops I've ever seen), and I spend most of my time navigating the UNIX environment from the command line. All my administrative tools have been built for this interface, so I can use them over a low bandwidth (even 300 baud) line if necessary.

If I'm to take NT seriously as a server, I'll need to see something other than that awful DOS shell. I feel like I'm doing administration with a diaper on.

I understand Microsoft's marketing approach that NT is an easy-to-administer server, but it can't be all things to all people. If I'm to seriously consider replacing the tried-and-true UNIX servers with NT servers, Microsoft will have to accommodate my need for more control over the OS from the command line. I'll give one example: edlin. If makes the OS crawl, why not just add edlin? If you hate edlin, don't use it.

Adding low-tech and low-bandwidth intensive tools to the OS and providing more standard scripting capabilities will eventually seduce us UNIX snobs over to the dark side. Thanks for a great magazine that is well worth its subscription price.

Corrections to this Article:

  • I noticed an error the the Reader to Reader listing, "C Program Listing for a Message of the Day." Three angle brackets are missing at the top three #include header files. The MS C++ compiler issues the "missing > error" and refuses to compile the program. When I add the angle brackets, the program compiled without error. Tai Nguyen [email protected]
Hide 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.