Poor Man's SU Utility
[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 Bemowski at kbemowski@winntmag.com. Please include your phone number. We will edit submissions for style, grammar, and length. If we print your letter, you'll get $100.]
While logged on to a workstation with a user account, you might need to access that machine's drives as an administrative user. For example, on a user's workstation, you might need to modify files that the user account can't access. You can use the Microsoft Windows NT Workstation 4.0 Resource Kit SU utility to run a process as another user, but this utility can be unwieldy to set up and use. (For information about SU, see Mark Minasi, "SU," January 1998.)
An alternative is to use the NET USE command to connect to a network resource (such as a share), even if that resource is on your current machine. For example, you can connect to your machine's C drive as an administrator by typing the command
net use W: \\mymachine\c$ /user:administrator
This command maps the W drive to the C drive of mymachine. If you access the drive as W, you have administrative permissions. If you access it through C, you have the user account's permissions. If you open a window for W and another for C, you have side-by-side windows that have different privileges.
The NET USE command doesn't limit you to becoming another administrative user. You can become any user if you know that person's password. This flexibility can be useful. For example, you can test a program as a user to make sure the program's access control lists (ACLs) are set up correctly. To become another user, specify that person's user account in the NET USE command. However, user accounts cannot access administrative shares, so you must set up shares manually if you want to access them as non-administrative users.
When you complete your task, discontinue the mapping. Type the command
net use w: /delete
Shawn Bayern
shawn.bayern@yale.edu