Downloads
4821.zip

\[Editor's note: Email your scripting solutions (400 words or less) to R2R at win32sj@winntmag.com. Please include your script and your phone number. We will edit submissions for style, grammar, and length. If we print your contribution, you'll get $100.\]

I encountered a problem at a client site involving permissions on user workstations. The site had moved several hundred workstations from one domain to another. After the site created new user accounts and added workstations to the new domain, users began to experience annoying permissions problems. Fixing these problems became a top priority when high-level users were greeted with an Access Denied message after clicking on files they had created before the migration.

I investigated the problems and found that the site had created an application and data files in the context of old user IDs, which meant that the application and files were associated with a different security ID (SID). As a result, users couldn't access the files.

I didn't want to manually change the permissions with a third-party utility because of the possibility of causing more problems on shared workstations. Also, physically visiting each workstation would've been too time-consuming. So I created RepairPerm.bat to correct the problems automatically. This script remotely attaches to the C$ share. RepairPerm.bat has built-in error-correcting code (ECC) and uses the Microsoft Windows NT Server 4.0 Resource Kit utilities subinacl.exe and getsid.exe to fix the permissions.

If you're migrating domains and run into permissions problems, RepairPerm.bat might help. You can find this script on the Win32 Scripting Journal Web site (http://www.winntmag.com/newsletter/scripting).


WSH Script Resets Users' Logon ID


As an administrator supporting a division with 125 Windows NT workstations, I am constantly logging on to users' PCs with a domain administrator username. I've developed a Windows Scripting Host (WSH) script, ResetUserID.vbs, that resets the PCs to the users' logon ID and domain. That way, users see their username the next time they log on. The script resets the default username and default domain name to whatever the users specify in the pop-up windows.

This script writes to the NT Registry, so you need to be careful when you use it. Be sure to back up the Registry before you use this script for the first time and before you modify it thereafter. Listing 1 contains an excerpt from ResetUserID.vbs. You'll find the entire ResetUserID.vbs script on the Win32 Scripting Journal Web site (http://www.winntmag.com/newsletter/scripting.)


Windows NT's Missing TCP/IP Utility



In the past, if you wanted to gather vital information about a computer, you had to use several Windows NT command-line utilities. However, I have created NetInfo.cmd, a utility that lets you gather this information in one step. With NetInfo.cmd, you just specify the computer name or username. If you specify the username, the script returns the name of the computer that the specified user is logged on to and the computer's IP and media access control (MAC) addresses. If you specify the computer name, the script returns the name of user who is logged on to that computer and the computer's IP and MAC addresses. Listing 2 contains an excerpt from NetInfo.cmd. The entire script is on the Win32 Scripting Journal Web site (http://www.winntmag.com/newsletter/scripting).