Looping over User Profile Directories

I wrote the following script a few years ago to help me loop over all user profiles to make changes to a configuration file that was stored there.  The target systems were all Windows XP and Windows 7 at the time, but I couldn’t be certain where the profiles would be (C:\Documents and Settings, C:\Users, D:\Users, etc), and I wanted to make sure to hit only valid profiles and not old copies such as username.old, that were left behind from troubleshooting.

The following script does just that.  I will not run on Windows 2000, since profiles were stored back in the Windows Directory then, and I want to ignore that folder, but it should run fine on Windows 8, although untested.  You could reuse this script to help delete certain folders from every existing profile, update an INI, or even create a folder on every desktop without using the the single public desktop.

The script is written with AutoIt, but it should be easy enough to translate into your language of choice. Sorry for the lack of comment, it was something I threw together quickly to resolve a problem in the environment.

FacebooktwitterredditpinterestlinkedinmailFacebooktwitterredditpinterestlinkedinmail

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.