Using the Script
To get GetUserProfiles.bat working in your environment, follow these steps:
- Download GetUserProfiles.bat from the Windows Scripting Solutions Web site. (See page 1 for download information.)
- Download NetUsers.exe from SystemTools.com (http://www.systemtools.com/free.htm). I used version 1.22 for this script.
- Create an input file that contains the machines on which you want to enumerate user profiles. Place one computer name per line. You must have local Administrator authority on the machines you're accessing.
- Configure the paths to the input, output, and NetUsers files. The script's comments detail where to make these configurations.
- Customize the output file if necessary. I set up the output file to be a .tsv file rather than a .csv file because the friendly names in my environment contain commas. If the friendly names in your environment don't contain commas and you prefer the output file to be a .csv file, you can replace the tabs with commas. The script's comments detail where these changes need to be made.
- Initially run the script against one or two test computers. Check the output file to make sure the run was successful before running the script in your production environment.
I ran GetUserProfiles.bat on computers running Windows XP Service Pack 2 (SP2) and Windows 2000 Professional SP4. The test run returned information when run against Windows Server 2003, XP, and Win2K machines.
A Multipurpose Tool
By using GetUserProfiles.bat, you can clean up old user profiles on your shared PC. By looking at how GetUserProfiles.bat operates, you can learn how to error-proof paths in your scripts and perform some advanced string manipulations. No matter whether you use this script for one or both purposes, it can be a valuable tool.