Windows IT Pro is the leading independent community for IT professionals deploying Microsoft Windows server and client applications and technologies.
  
  
  Advanced Search 


May 08, 2006

Learn How to Error-Proof Paths and Creatively Manipulate Strings

And you even get a script that enumerates user profiles to boot
RSS
Subscribe to Windows IT Pro | See More Task Automation Articles Here | Reprints | Or get the Monthly Online Pass—only $5.95 a month!

Download the Code Here

Using the Script
To get GetUserProfiles.bat working in your environment, follow these steps:

  1. Download GetUserProfiles.bat from the Windows Scripting Solutions Web site. (See page 1 for download information.)
  2. Download NetUsers.exe from SystemTools.com (http://www.systemtools.com/free.htm). I used version 1.22 for this script.
  3. 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.
  4. Configure the paths to the input, output, and NetUsers files. The script's comments detail where to make these configurations.
  5. 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.
  6. 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.

End of Article

   Previous  1  2  [3]  Next  


Reader Comments

You must be a registered user or online subscriber to comment on this article. Please log on before posting a comment. Are you a new visitor? Register now




Top Viewed ArticlesView all articles
WinInfo Short Takes: Week of November 9, 2009

An often irreverent look at some of the week's other news, including some more Windows 7 sales momentum, some Sophos stupidity, Microsoft's cloud computing self-loathing, more whining from the browser makers, Zoho's "Fake Office," and much, much more ...

Command Prompt Tricks

One reader shares his tip for setting up the command prompt to reflect a remote path. ...

Windows 7 Sets Sales Record

Microsoft CEO Steve Ballmer described Windows 7's first ten days of sales as "fantastic" while in Japan yesterday. ...


Task Automation Whitepapers From Development to Production: Streamlining SharePoint Deployment with DocAve Deployment Manager

Will Your Next Generation Server System Meet Your Infrastructure Optimization Needs?

Continuous Data Protection and Recovery for Microsoft Exchange

Related Events Check out our list of Free Email Newsletters!

Task Automation eBooks Spam Fighting and Email Security for the 21st Century

A Guide to Windows Certification and Public Keys

Keeping Your Business Safe from Attack: Patch Management

Related Task Automation Resources Introducing Left-Brain.com, the online IT bookstore
Looking for books, CDs, toolkits, eBooks? Prime your mind at Left-Brain.com

Discover Windows IT Pro eLearning Series!
Clear & detailed technical information and helpful how-to's, all in our trademark no-nonsense format


Windows IT Pro Home Register FAQ for Windows WinInfo News
Europe Edition About Us Contact Us/Customer Service Media Kit Affiliates / Licensing  
SQL Server Magazine Office & SharePoint Pro DevProConnections IT Job Hound
Left-Brain.com Technology Resource Directory asp.netPRO ITTV Windows SuperSite 
 
 Windows IT Pro is a Division of Penton Media Inc.
 © 2009 Penton Media, Inc. Terms of Use | Privacy Statement