Video Screencast Help
Search Video Help Close Back
to help
New in the Rewards Catalog: Vouchers for "Symantec Technical Specialist" and "Symantec Certified Specialist" exams.

Make Changes to All Profiles - VB Script

Updated: 18 Aug 2008 | 1 comment
MtBiker's picture
0 0 Votes
Login to vote

This is a simple VB script to modify all the profiles at once. Most the time you can use the "All Users" profile to make changes to all the profiles but there has been times when I've found this little script handy. For instance, it's a nice way of printing out all profiles on a system. But there are many things that this script can do.

'This script will allow you to make changes to all current profiles in the system

' strValue = user profiles (C:\Documents and Settings\profile)

On Error Resume Next

Const HKEY_LOCAL_MACHINE = &H80000002

strComputer = "."
 
Set objRegistry=GetObject("winmgmts:\\" & _ 
  strComputer & "\root\default:StdRegProv")
 
strKeyPath = "SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList"
objRegistry.EnumKey HKEY_LOCAL_MACHINE, strKeyPath, arrSubkeys
 
For Each objSubkey In arrSubkeys
  strValueName = "ProfileImagePath"
  strSubPath = strKeyPath & "\" & objSubkey
  objRegistry.GetExpandedStringValue HKEY_LOCAL_MACHINE,strSubPath,strValueName,strValue
  'replace this line with the tasks you wish to accomplish with the profiles. Use the strValue varible
  Wscript.Echo strValue
Next

As you will notice, there is a place in the for loop of the script to add the action item you would like taken place. Play with it, hope somebody else finds something useful for this.

If you have questions, you can reach me on the Altiris Juice Chat, my nick is MtBiker

Comments

JoeVan's picture
19
Aug
2008
0 Votes 0
Login to vote

Good Start for profile enumeration

This is a good start to generate a list of profile GUIDs (which I've needed in the past) and profile locations. A little more work is needed if you want to modify settings within those profiles. You'd want to mount the ntuser.dat located in the paths you find and then modify desired settings within those temporary hive mountpoints.

Joe VanHollebeke
Systems Engineer

Please improve the connect community... give a thumbs up to useful posts and mark solutions as solutions!