none
How to copy and fix default profile RRS feed

  • General discussion

  • Hi all,

    I know I'm not alone struggling with Win 7 and default profile, just look at the Deployment guys' blog, you'll see how many people are suffering from the "standard" MS has imposed upon us. Instead of whining and waiting for MS to make a tool that may or may not happen, I decided to take matters into my own hands.

    I made 5 Win 7 images with various degree of customization, copied the profile using Windows Enabler, which complies with method A described in the blog, and compared the registries of them, and found out that there're 42 outstanding hard links pointing to the "template" user's profile, which may or may not exist. Funning thing is, if you forgot to delete the template user's profile, a newly created user may well inherit the settings and everything appears to be working, until one day a program fails to install.

    I'll list the hard links in my second post. I'm sure you may find more broken hard links, but the point is, I'm trying to show you guys a way to work around it, so bare with me.

    If you find my method helpful, please cast a vote of helpful, or join the discussion. It's gratifying to see I can be of some help to my fellow IT pros. Thanks in advance!

    Friday, March 5, 2010 2:44 PM

All replies

  • Here's the list of common broken hard links in the registry. My template user name is "Authorized User". When a new user with a different name logs in, the hard links are inherited, thus rendering the OS inoperable. The fix can be found from the 3rd post.

    List 1
    [HKEY_USERS\New_Default\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders]
    "!Do not use this registry key"="Use the SHGetFolderPath or SHGetKnownFolderPath function instead"
    "AppData"="C:\\Users\\Authorized User\\AppData\\Roaming"
    "Local AppData"="C:\\Users\\Authorized User\\AppData\\Local"
    "My Video"="C:\\Users\\Authorized User\\Videos"
    "{1B3EA5DC-B587-4786-B4EF-BD1DC332AEAE}"="C:\\Users\\Authorized User\\AppData\\Roaming\\Microsoft\\Windows\\Libraries"
    "My Pictures"="C:\\Users\\Authorized User\\Pictures"
    "Desktop"="C:\\Users\\Authorized User\\Desktop"
    "History"="C:\\Users\\Authorized User\\AppData\\Local\\Microsoft\\Windows\\History"
    "NetHood"="C:\\Users\\Authorized User\\AppData\\Roaming\\Microsoft\\Windows\\Network Shortcuts"
    "{56784854-C6CB-462B-8169-88E350ACB882}"="C:\\Users\\Authorized User\\Contacts"
    "Cookies"="C:\\Users\\Authorized User\\AppData\\Roaming\\Microsoft\\Windows\\Cookies"
    "Favorites"="C:\\Users\\Authorized User\\Favorites"
    "SendTo"="C:\\Users\\Authorized User\\AppData\\Roaming\\Microsoft\\Windows\\SendTo"
    "Start Menu"="C:\\Users\\Authorized User\\AppData\\Roaming\\Microsoft\\Windows\\Start Menu"
    "My Music"="C:\\Users\\Authorized User\\Music"
    "Programs"="C:\\Users\\Authorized User\\AppData\\Roaming\\Microsoft\\Windows\\Start Menu\\Programs"
    "Recent"="C:\\Users\\Authorized User\\AppData\\Roaming\\Microsoft\\Windows\\Recent"
    "CD Burning"="C:\\Users\\Authorized User\\AppData\\Local\\Microsoft\\Windows\\Burn\\Burn"
    "PrintHood"="C:\\Users\\Authorized User\\AppData\\Roaming\\Microsoft\\Windows\\Printer Shortcuts"
    "{7D1D3A04-DEBB-4115-95CF-2F29DA2920DA}"="C:\\Users\\Authorized User\\Searches"
    "{374DE290-123F-4565-9164-39C4925E467B}"="C:\\Users\\Authorized User\\Downloads"
    "{A520A1A4-1780-4FF6-BD18-167343C5AF16}"="C:\\Users\\Authorized User\\AppData\\LocalLow"
    "Startup"="C:\\Users\\Authorized User\\AppData\\Roaming\\Microsoft\\Windows\\Start Menu\\Programs\\Startup"
    "Administrative Tools"="C:\\Users\\Authorized User\\AppData\\Roaming\\Microsoft\\Windows\\Start Menu\\Programs\\Administrative Tools"
    "Personal"="C:\\Users\\Authorized User\\Documents"
    "{BFB9D5E0-C6A9-404C-B2B2-AE6DB6AF4968}"="C:\\Users\\Authorized User\\Links"
    "Cache"="C:\\Users\\Authorized User\\AppData\\Local\\Microsoft\\Windows\\Temporary Internet Files"
    "Templates"="C:\\Users\\Authorized User\\AppData\\Roaming\\Microsoft\\Windows\\Templates"
    "{4C5C32FF-BB9D-43B0-B5B4-2D72E54EAAA4}"="C:\\Users\\Authorized User\\Saved Games"
    "Fonts"="C:\\Windows\\Fonts"
    
    [HKEY_USERS\New_Default\Control Panel\Desktop]
    "Wallpaper"="C:\\Users\\Authorized User\\AppData\\Roaming\\Microsoft\\Windows\\Themes\\TranscodedWallpaper.jpg"
    
    [HKEY_USERS\New_Default\Software\Microsoft\Internet Explorer\LinksBar\ItemCache\0]
    "Path"="C:\\Users\\Authorized User\\Favorites\\Links\\Suggested Sites.url"
    
    [HKEY_USERS\New_Default\Software\Microsoft\Internet Explorer\LinksBar\ItemCache\1]
    "Path"="C:\\Users\\Authorized User\\Favorites\\Links\\Web Slice Gallery.url"
    
    [HKEY_USERS\New_Default\Software\Microsoft\Internet Explorer\Main\WindowsSearch]
    "User Favorites Path"="file:///C:\\Users\\Authorized User\\Favorites\\"
    
    [HKEY_USERS\New_Default\Software\Microsoft\Internet Explorer\SearchScopes\{0633EE93-D776-472f-A0FF-E1416B8B2E3A}]
    "FaviconPath"="C:\\Users\\Authorized User\\AppData\\LocalLow\\Microsoft\\Internet Explorer\\Services\\search_{0633EE93-D776-472f-A0FF-E1416B8B2E3A}.ico"
    
    [HKEY_USERS\New_Default\Software\Microsoft\Internet Explorer\SearchScopes\{6A1806CD-94D4-4689-BA73-E35EA1EA9990}]
    "FaviconPath"="C:\\Users\\Authorized User\\AppData\\LocalLow\\Microsoft\\Internet Explorer\\Services\\search_{6A1806CD-94D4-4689-BA73-E35EA1EA9990}.ico"
    
    [HKEY_USERS\New_Default\Software\Microsoft\Internet Explorer\Suggested Sites]
    "SlicePath"="C:\\Users\\Authorized User\\Favorites\\Links\\Suggested Sites.url"
    
    [HKEY_USERS\New_Default\Software\Microsoft\MediaPlayer\Preferences]
    "ObfuscatedSyncPlaylistsPath"="C:\\Users\\Authorized User\\AppData\\Local\\Microsoft\\Media Player\\Sync Playlists\\fi-FI\\001BA001"
    
    [HKEY_USERS\New_Default\Software\Microsoft\WAB\Me]
    @="/GUID:\"7e06784d-4be4-4955-9b9f-a00990e54aa3\" /PATH:\"C:\\Users\\Authorized User\\Contacts\\Authorized User.contact\""
    
    [HKEY_USERS\New_Default\Software\Microsoft\Windows\CurrentVersion\Explorer\CD Burning\StagingInfo\Volume{3d25f257-2637-11df-a6b7-806e6f6e6963}]
    "StagingPath"="C:\\Users\\Authorized User\\AppData\\Local\\Microsoft\\Windows\\Burn\\Burn"
    
    [HKEY_USERS\New_Default\Software\Microsoft\Windows Media\WMSDK\Namespace]
    "LocalBase"="C:\\Users\\Authorized User\\AppData\\Local\\Microsoft\\Windows Media\\12.0\\WMSDKNS.XML"
    "DTDFile"="C:\\Users\\Authorized User\\AppData\\Local\\Microsoft\\Windows Media\\12.0\\WMSDKNS.DTD"
    "LocalDelta"="C:\\Users\\Authorized User\\AppData\\Local\\Microsoft\\Windows Media\\12.0\\WMSDKNSD.XML"
    "RemoteDelta"="C:\\Users\\Authorized User\\AppData\\Local\\Microsoft\\Windows Media\\12.0\\WMSDKNSR.XML"
    
    Friday, March 5, 2010 2:51 PM
  • Before using the method I describe here, I assume that you're an IT pro, who has a fair amount of knowlege with the common tools, such as Regedit (load/unload; Import/Export), Dism, and is able to inteprete basic programming code and knows what it does.

    I use kiXtart as my programming language (I hope I don't jinx you, Ruud, as MS has the habit of taking away everything that's good) for 2 reasons, first, I'm comfortable with it; second, it's precise like a surgical knife, and doesn't have all the nonsense fancy schmancy of VB. I bet if I wrote the code in VB, it's be a mile longer and 10 times slower. Well, my code isn't exactly elegant either, to be honest. However, if you know how to translate kiX into VB, and don't mind doing a favor to the general public, please share your code too. Thanks in advance!

    List 2. Fix_Default.kix

    ;; *** kiXtart script
    ;; *** Refer to <http://www.kixtart.org> for binaries and manual.
    
    ;; ***   <script language="kiXtart" >
    ;; ***   <script language="kiXtart">
    
    ;; ***  Copyright? Well, you can always make it better and faster, but it would be nice if you can share the source with us.
    ;; ***	File:      Fix_Default.kix
    ;; ***	Version:   0.0.1
    ;; ***	Purpose:   Fix broken hard links to point to current user profile
    ;; *** 	Usage:     kix32.exe Fix_Default.kix
    ;; ***  RunOnce doesn't recognize "%systemroot%, need to use a hard link(absolute path)like C:\windows instead.
    
    $Prd = @ProductType
    If  $Prd = "Windows 7 Enterprise Edition" or left($Prd, 9) = "Windows 7"
    DIM $SFS

    ;; *** Under "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders", there're 28 hard linked registries. ;; *** This fixes the links to point to current user. $SFS = "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" $1 = ReadValue ($SFS, "AppData") $2 = ReadValue ($SFS, "Local AppData") $3 = ReadValue ($SFS, "My Video") $4 = ReadValue ($SFS, "{1B3EA5DC-B587-4786-B4EF-BD1DC332AEAE}") $5 = ReadValue ($SFS, "My Pictures") $6 = ReadValue ($SFS, "Desktop") $7 = ReadValue ($SFS, "History") $8 = ReadValue ($SFS, "NetHood") $9 = ReadValue ($SFS, "{56784854-C6CB-462B-8169-88E350ACB882}") $10 = ReadValue ($SFS, "Cookies") $11 = ReadValue ($SFS, "Favorites") $12 = ReadValue ($SFS, "SendTo") $13 = ReadValue ($SFS, "Start Menu") $14 = ReadValue ($SFS, "My Music") $15 = ReadValue ($SFS, "Programs") $16 = ReadValue ($SFS, "Recent") $17 = ReadValue ($SFS, "CD Burning") $18 = ReadValue ($SFS, "PrintHood") $19 = ReadValue ($SFS, "{7D1D3A04-DEBB-4115-95CF-2F29DA2920DA}") $20 = ReadValue ($SFS, "{374DE290-123F-4565-9164-39C4925E467B}") $21 = ReadValue ($SFS, "{A520A1A4-1780-4FF6-BD18-167343C5AF16}") $22 = ReadValue ($SFS, "Startup") $23 = ReadValue ($SFS, "Administrative Tools") $24 = ReadValue ($SFS, "Personal") $25 = ReadValue ($SFS, "{BFB9D5E0-C6A9-404C-B2B2-AE6DB6AF4968}") $26 = ReadValue ($SFS, "Cache") $27 = ReadValue ($SFS, "Templates") $28 = ReadValue ($SFS, "{4C5C32FF-BB9D-43B0-B5B4-2D72E54EAAA4}") $1v = "%UserProfile%\AppData\Roaming" $2v = "%UserProfile%\AppData\Local" $3v = "%UserProfile%\Videos" $4v = "%UserProfile%\AppData\Roaming\Microsoft\Windows\Libraries" $5v = "%UserProfile%\Pictures" $6v = "%UserProfile%\Desktop" $7v = "%UserProfile%\AppData\Local\Microsoft\Windows\History" $8v = "%UserProfile%\AppData\Roaming\Microsoft\Windows\Network Shortcuts" $9v = "%UserProfile%\Contacts" $10v = "%UserProfile%\AppData\Roaming\Microsoft\Windows\Cookies" $11v = "%UserProfile%\Favorites" $12v = "%UserProfile%\AppData\Roaming\Microsoft\Windows\SendTo" $13v = "%UserProfile%\AppData\Roaming\Microsoft\Windows\Start Menu" $14v = "%UserProfile%\Music" $15v = "%UserProfile%\AppData\Roaming\Microsoft\Windows\Start Menu\Programs" $16v = "%UserProfile%\AppData\Roaming\Microsoft\Windows\Recent" $17v = "%UserProfile%\AppData\Local\Microsoft\Windows\Burn\Burn" $18v = "%UserProfile%\AppData\Roaming\Microsoft\Windows\Printer Shortcuts" $19v = "%UserProfile%\Searches" $20v = "%UserProfile%\Downloads" $21v = "%UserProfile%\AppData\LocalLow" $22v = "%UserProfile%\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup" $23v = "%UserProfile%\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Administrative Tools" $24v = "%UserProfile%\Documents" $25v = "%UserProfile%\Links" $26v = "%UserProfile%\AppData\Local\Microsoft\Windows\Temporary Internet Files" $27v = "%UserProfile%\AppData\Roaming\Microsoft\Windows\Templates" $28v = "%UserProfile%\Saved Games" If $1 <> $1v $Nul = WriteValue($SFS, "AppData", $1v, "Reg_SZ") Endif If $2 <> $2v $Nul = WriteValue($SFS, "Local AppData", $2v, "Reg_SZ") Endif If $3 <> $3v $Nul = WriteValue($SFS, "My Video", $3v, "Reg_SZ") Endif If $4 <> $4v $Nul = WriteValue($SFS, "{1B3EA5DC-B587-4786-B4EF-BD1DC332AEAE}", $4v, "Reg_SZ") Endif If $5 <> $5v $Nul = WriteValue($SFS, "My Pictures", $5v, "Reg_SZ") Endif If $6 <> $6v $Nul = WriteValue($SFS, "Desktop", $6v, "Reg_SZ") Endif If $7 <> $7v $Nul = WriteValue($SFS, "History", $7v, "Reg_SZ") Endif If $8 <> $8v $Nul = WriteValue($SFS, "NetHood", $8v, "Reg_SZ") Endif If $9 <> $9v $Nul = WriteValue($SFS, "{56784854-C6CB-462B-8169-88E350ACB882}", $9v, "Reg_SZ") Endif If $10 <> $10v $Nul = WriteValue($SFS, "Cookies", $10v, "Reg_SZ") Endif If $11 <> $11v $Nul = WriteValue($SFS, "Favorites", $11v, "Reg_SZ") Endif If $12 <> $12v $Nul = WriteValue($SFS, "SendTo", $12v, "Reg_SZ") Endif If $13<> $13v $Nul = WriteValue($SFS, "Start Menu", $13v, "Reg_SZ") Endif If $14 <> $14v $Nul = WriteValue($SFS, "My Music", $14v, "Reg_SZ") Endif If $15 <> $15v $Nul = WriteValue($SFS, "Programs", $15v, "Reg_SZ") Endif If $16 <> $16v $Nul = WriteValue($SFS, "Recent", $16v, "Reg_SZ") Endif If $17 <> $17v $Nul = WriteValue($SFS, "CD Burning", $17v, "Reg_SZ") Endif If $18 <> $18v $Nul = WriteValue($SFS, "PrintHood", $18v, "Reg_SZ") Endif If $19 <> $19v $Nul = WriteValue($SFS, "{7D1D3A04-DEBB-4115-95CF-2F29DA2920DA}", $19v, "Reg_SZ") Endif If $20 <> $20v $Nul = WriteValue($SFS, "{374DE290-123F-4565-9164-39C4925E467B}", $20v, "Reg_SZ") Endif If $21 <> $21v $Nul = WriteValue($SFS, "{A520A1A4-1780-4FF6-BD18-167343C5AF16}", $21v, "Reg_SZ") Endif If $22 <> $22v $Nul = WriteValue($SFS, "Startup", $22v, "Reg_SZ") Endif If $23 <> $23v $Nul = WriteValue($SFS, "Administrative Tools", $23v, "Reg_SZ") Endif If $24 <> $24v $Nul = WriteValue($SFS, "Personal", $24v, "Reg_SZ") Endif If $25 <> $25v $Nul = WriteValue($SFS, "{BFB9D5E0-C6A9-404C-B2B2-AE6DB6AF4968}", $25v, "Reg_SZ") Endif If $26 <> $26v $Nul = WriteValue($SFS, "Cache", $26v, "Reg_SZ") Endif If $27 <> $27v $Nul = WriteValue($SFS, "Templates", $27v, "Reg_SZ") Endif If $28 <> $28v $Nul = WriteValue($SFS, "{4C5C32FF-BB9D-43B0-B5B4-2D72E54EAAA4}", $28v, "Reg_SZ") Endif ;; *** Miscellaneous hard links that do not appear to affect OS functionality, but fix them anyway. $SFS = "HKEY_CURRENT_USER\Control Panel\Desktop" $29 = ReadValue ($SFS, "Wallpaper") $29v = "%USERPROFILE%\AppData\\Roaming\Microsoft\Windows\Themes\TranscodedWallpaper.jpg" If $29 <> $29v $Nul = WriteValue($SFS, "Wallpaper", $1v, "Reg_SZ") Endif $SFS = "HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\LinksBar\ItemCache\0" If $30 <> $30v $Nul = WriteValue ($SFS, "Path", $30v, "Reg_SZ") Endif $SFS = "HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\LinksBar\ItemCache\1" $31 = ReadValue ($SFS, "Path") $31v = "%USERPROFILE%\Favorites\Links\Web Slice Gallery.url" If $31 <> $31v $Nul = WriteValue ($SFS, "Path", $31v, "Reg_SZ") Endif $SFS = "HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main\WindowsSearch" $32 = ReadValue($SFS, "User Favorites Path") $32v = "file:///%USERPROFILE%\Favorites\" If $32 <> $32v $Nul = WriteValue ($SFS, "User Favorites Path", $32v, "Reg_SZ") Endif $SFS = "HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\SearchScopes\{0633EE93-D776-472f-A0FF-E1416B8B2E3A}" $33 = ReadValue ($SFS, "FaviconPath") $33v = "%USERPROFILE\AppData\LocalLow\Microsoft\Internet Explorer\Services\search_{0633EE93-D776-472f-A0FF-E1416B8B2E3A}.ico" If $33 <> $33v $Nul = WriteValue ($SFS, "User Favorites Path", $33v, "Reg_SZ") Endif $SFS = "HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\SearchScopes\{6A1806CD-94D4-4689-BA73-E35EA1EA9990}" $34 = ReadValue ($SFS, "FaviconPath") $34v = "%USERPROFILE\AppData\LocalLow\Microsoft\Internet Explorer\Services\search_{6A1806CD-94D4-4689-BA73-E35EA1EA9990}.ico" If $34 <> $34v $Nul = WriteValue ($SFS, "User Favorites Path", $34v, "Reg_SZ") Endif $SFS = "HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Suggested Sites" $35 = ReadValue ($SFS, "SlicePath") $35v = "%USERPROFILE\Favorites\Links\Suggested Sites.url" If $35 <> $35v $Nul = WriteValue ($SFS, "SlicePath", $35v, "Reg_SZ") Endif $SFS = "HKEY_CURRENT_USER\Software\Microsoft\Windows Media\WMSDK\Namespace" $36 = ReadValue ($SFS, "LocalBase") $36v = "%USERPROFILE%\AppData\Local\Microsoft\Windows Media\12.0\WMSDKNS.XML" $37 = ReadValue ($SFS, "DTDFile") $37v = "%USERPROFILE%\AppData\Local\Microsoft\Windows Media\12.0\WMSDKNS.DTD" $38 = ReadValue ($SFS, "LocalDelta") $38v = "%USERPROFILE%\AppData\Local\Microsoft\Windows Media\12.0\WMSDKNSD.XML" $39 = ReadValue ($SFS, "RemoteDelta") $39v = "%USERPROFILE%\AppData\Local\Microsoft\Windows Media\12.0\WMSDKNSR.XML" If $36<> $36v $Nul = WriteValue ($SFS, "LocalBase", $36v, "Reg_SZ") Endif If $37 <> $37v $Nul = WriteValue ($SFS, "DTDFile", $37v, "Reg_SZ") Endif If $38<> $38v $Nul = WriteValue ($SFS, "LocalDelta", $38v, "Reg_SZ") Endif If $39<> $39v $Nul = WriteValue ($SFS, "RemoteDelta", $39v, "Reg_SZ") Endif ;; *** The following works OK if used with RunOnce, but if implemented in logon scripts, make sure to add a routine check to prevent cyclic deletion. $SFS = "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\CD Burning\StagingInfo" $Nul = Deltree ($SFS) $Nul = AddKey ($SFS) $SFS = "HKEY_CURRENT_USER\Software\Microsoft\MediaPlayer\Preferences" $Nul = WriteValue($SFS, "ObfuscatedSyncPlaylistsPath","","Reg_SZ") $SFS = "HKEY_CURRENT_USER\Software\Microsoft\WAB\Me" $Nul = DelValue($SFS, "@") Endif
    • Edited by wei2ali Friday, March 5, 2010 8:26 PM
    Friday, March 5, 2010 3:19 PM
  • Ok, now, how to use it?

    Download KiX2010.461, unzip the files into your Windows\System32 -folder. Save the code in List 2 as "Fix_Default.kix" into "C:\Windows"; or, somewhere which is accessible by the OS and the user, make a batch file with the following command, and save it as "Fix_Default.cmd"
    List 3: Fix_Default.cmd

    "%SystemRoot%\System32\Kix32.exe" "%SystemRoot%\Fix_Default.kix"


    I will go through only 1 scenario, that is, you'll already made an image of Win 7. Here's how I do it:

    1. DISM, mount the image where the "Users\Default" resides.
    2. Load hive "DriveLetter:\Mount\Users\Default\ntuser.dat" from the image.
    3. Browse into "HKEY_USERS\Your_loaded_hive\Software\Microsoft\Windows\CurrentVersion\RunOnce"
    4. Add new string value "!FixDefault"
    5. Modify the string value to point to the batch file, say "C:\Windows\Fix_Default.cmd"
    6. Unload hive.
    7. DISM, unmount and commit.

    Ok, to be fair, I lied a little. Here's another scenario that you might be comfortable with.

    In the reference machine you make image from, go through steps 2 to 6, make a new user, reboot or log off, log in as the new user, check the registries of "HKEY_CURRENT_USER", and get amazed.

    I'm open to praises and suggestions, specially the former (:p), but I do hope that some one with more skills can take time to make this a proper tool, so that all IT pro will breathe easier.

    You know what? After editing this for the 7th time, I really think they should put a preview pane function in this Forum. Too hard for MS?

    • Edited by wei2ali Friday, March 5, 2010 8:12 PM Edit
    Friday, March 5, 2010 4:15 PM
  • Oh, a comment. You might ask: why can't I change the user name directly to %USERNAME% in the registry? The answer is: it doesn't get translated all the time, sometimes it works, but mostly it doesn't. I tested it, trust me ;).
    Friday, March 5, 2010 8:16 PM
  • Thank you very much for this. It fixed quite a few issues in our environment.
    Wednesday, February 16, 2011 6:06 PM