Reset Vista Folder Customizations To Default

Author Message
DiGiTAL.SkReAM

  • Total Posts : 1259
  • Scores: 7
  • Reward points : 0
  • Joined: 9/7/2005
  • Location: Clearwater, FL, USA
  • Status: offline
Reset Vista Folder Customizations To Default Saturday, March 10, 2007 12:45 PM (permalink)
0
I noticed the other day that all of my folders seemed to be showing info in details for media files, ie, Artist, Album, Track#, Genre, etc.
This was rather disturbing while viewing my script directory.  On folders that i specifically set the info to be size, type, date modified, etc. things worked fine.  On most others, it was in "media view" - as if I had right-clicked the folders and selectesd Customize -> Music Details...  only I hadn't.  So, to fix this across all my drives, without having to manually modify each folder, I came up with this:
 '==========================================================================
 '
 ' SCRIPT NAME: ClearAllFoldersColumnSettings.vbs
 '
 ' AUTHOR: DiGiTAL.SkReAM
 ' DATE  : 3/10/2007
 '
 ' COMMENT: This script will erase the registry key which contains the folder customization settings
 '   for the current user.  This will force all folder customization settings for the current 
 '   user to be set back to the defaults.
 '==========================================================================
 Option Explicit 
 Const HKEY_CURRENT_USER = &H80000001
 Const HKEY_USERS = &H80000003
 Dim oShell, oFSO, oEnv, oNet, sSubKey, aSubKeys, s
 Set oShell = CreateObject("Wscript.Shell")
 GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\default:StdRegProv").EnumKey _
   HKEY_CURRENT_USER, "Software\Microsoft\Internet Explorer\InternetRegistry\REGISTRY\USER", aSubKeys
  For Each sSubKey In aSubKeys
   fKillRegKey "HKEY_USERS\" & sSubkey & "_Classes\Local Settings\Software\Microsoft\Windows\Shell\Bags"
  Next
 Function fKillRegKey(ByVal sKeyToDelete)
  Dim aSubKeys, sSubKey, iSubkeyCheck, sKeyToKill, iElement
  Dim aKeyPathSubSection, hKeyRoot, oWMIReg, strKeyRoot
  aKeyPathSubSection = Split(sKeyToDelete, "\")
  hKeyRoot = HKEY_USERS
  strKeyRoot = "HKEY_USERS"
   For iElement = 1 To UBound(aKeyPathSubSection)
    sKeyToKill = sKeyToKill & "\" & aKeyPathSubSection(iElement)   
   Next
   If Left(sKeyToKill,1) = "\" Then sKeyToKill = Right(sKeyToKill, Len(sKeyToKill)-1)
  'Errors will be generated when there are no subkeys during recursion - this is normal and expected
  On Error Resume Next
  Set oWMIReg = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\default:StdRegProv")
  iSubkeyCheck = oWMIReg.EnumKey(hKeyRoot, sKeyToKill, aSubKeys)
   If iSubkeyCheck = 0 And IsArray(aSubKeys) Then
     For Each sSubKey In aSubKeys
       If Err.Number <> 0 Then
        Err.Clear
        Exit Function 
       End If
      'Recursively call this function, to delete each subkey - and their subkeys, and so on...
      fKillRegKey strKeyRoot & "\" & sKeyToKill & "\" & sSubKey
     Next
   End If
  'if the key has no subkeys, delete it.
  oShell.RegDelete strKeyRoot & "\" & sKeyToKill & "\"
 End Function
 

 
Hope it helps someone else.
 
"Would you like to touch my monkey?" - Dieter (Mike Meyers)

"It is better to die like a tiger, than to live like a pussy."
-Master Wong, from Balls of Fury
 
#1
    Parabellum

    • Total Posts : 233
    • Scores: 0
    • Reward points : 0
    • Joined: 11/12/2006
    • Location: UK
    • Status: offline
    RE: Reset Vista Folder Customizations To Default Monday, March 12, 2007 10:49 AM (permalink)
    0
    nice one.. thanks... saved me an afternoons work :)
     
    #2
      DiGiTAL.SkReAM

      • Total Posts : 1259
      • Scores: 7
      • Reward points : 0
      • Joined: 9/7/2005
      • Location: Clearwater, FL, USA
      • Status: offline
      RE: Reset Vista Folder Customizations To Default Monday, March 12, 2007 11:08 AM (permalink)
      0
      Yeah, MS tech support was worthless - spent 2.5 hours on the phone trying to figure this out with them, when I finally found the key in the registry.  The guy was like "Wow!  That's great!"  *sigh*
       
      "Would you like to touch my monkey?" - Dieter (Mike Meyers)

      "It is better to die like a tiger, than to live like a pussy."
      -Master Wong, from Balls of Fury
       
      #3

        Online Bookmarks Sharing: Share/Bookmark

        Jump to:

        Current active users

        There are 0 members and 1 guests.

        Icon Legend and Permission

        • New Messages
        • No New Messages
        • Hot Topic w/ New Messages
        • Hot Topic w/o New Messages
        • Locked w/ New Messages
        • Locked w/o New Messages
        • Read Message
        • Post New Thread
        • Reply to message
        • Post New Poll
        • Submit Vote
        • Post reward post
        • Delete my own posts
        • Delete my own threads
        • Rate post

        2000-2012 ASPPlayground.NET Forum Version 3.9