Jump to content

Welcome to MSFN Forum
Register now to gain access to all of our features. Once registered and logged in, you will be able to create topics, post replies to existing threads, give reputation to your fellow members, get your own private messenger, post status updates, manage your profile and so much more. This message will be removed once you have signed in.
Login to Account Create an Account



Photo

Default User Reg tweaks not being applied after Sysprep


  • Please log in to reply
7 replies to this topic

#1
imbecile29

imbecile29
  • Member
  • 6 posts
  • Joined 06-November 04
Hi everyone

This is my first time creating a Windows 7 sysprep image and what we normally do with XP is make the C drive the system partition and the D partition store the users desktop, documents, pictures folders etc. (The profile is still stored in C:\users but we move the location of those folders editing the following reg keys HKEY_USERS\Default\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders) Normally I would apply these changes to the default user profile.

When making these same changes to Windows 7 and running sysprep all these changes to the default user ntuser.dat file are lost. When I have tried to use FirstLogonCommands (OOBE) or RunSynchronous (Specialize) using the following batch file neither seem to have an effect.

<FirstLogonCommands>
				<SynchronousCommand wcm:action="add">
					<Order>1</Order>
					<Description>test</Description>
					<RequiresUserInput>false</RequiresUserInput>
					<CommandLine>C:\script\first.cmd</CommandLine>
				</SynchronousCommand>
			</FirstLogonCommands>
--first.cmd
start /wait reg load "hku\default" "C:\Users\Default\NTUSER.DAT"
start /wait reg import C:\script\RedirectDocumentsDesktop.reg
start /wait reg unload "hku\default"
Can anyone suggest what I might be doing wrong or a better way of doing it?


How to remove advertisement from MSFN

#2
MrJinje

MrJinje

    Tool™ Developer

  • Developer
  • 1,051 posts
  • Joined 14-October 09
  • OS:Server 2012R2
  • Country: Country Flag

When making these same changes to Windows 7 and running sysprep all these changes to the default user ntuser.dat file are lost.

I'm confused, do you want to make these changes before you sysprep, and then capture the image with these settings, or are you working with an image you already sysprepped, and want to make it work via the unattended method ?

The easiest way will be to take the script you already have and instead use SetupComplete.cmd to run it, this way it is applied to the default profile before your user account is created (that is why the settings are not being applied).

SetupComplete.cmd runs before the first login, so when the first login occurs (and your account is created), the changes have already been made in the default profile.

Place it in this folder on your DVD or USB drive.

DVD\Sources\$OEM$\$$\Setup\Scripts\SetupComplete.cmd

Edited by MrJinje, 06 January 2010 - 10:01 PM.


#3
imbecile29

imbecile29
  • Member
  • 6 posts
  • Joined 06-November 04
Firstly thanks for the reply

I'm confused, do you want to make these changes before you sysprep, and then capture the image with these settings, or are you working with an image you already sysprepped, and want to make it work via the unattended method ?

Ideally like I did with XP I would make the changes before sysprep. When trying that with win7 I make the changes then sysprep and before booting it up I load the ntuser.dat file again and my changes are allready missing. Which is why I thought I would try making the registry changes via unattended method as you have suggested.

The easiest way will be to take the script you already have and instead use SetupComplete.cmd to run it, this way it is applied to the default profile before your user account is created (that is why the settings are not being applied).

I have tried this aswell. I see a command prompt window open and close but the default ntuser.dat remains untouched. Which is why I posted the batch file just incase there was a mistake in it. Will this run with admin privledges?

Place it in this folder on your DVD or USB drive.
DVD\Sources\$OEM$\$$\Setup\Scripts\SetupComplete.cmd

I'm using ghost to create and deploy the images. So I'm placing the file in C:\windows\setup\scripts\setupcomplete.cmd. I then sysprep the computer. Capture and deploy it to another computer. but after setup and oobe have run it appears as if the setupcomplete.cmd hasn't been run.

#4
MrJinje

MrJinje

    Tool™ Developer

  • Developer
  • 1,051 posts
  • Joined 14-October 09
  • OS:Server 2012R2
  • Country: Country Flag

The easiest way will be to take the script you already have and instead use SetupComplete.cmd to run it, this way it is applied to the default profile before your user account is created (that is why the settings are not being applied).

I have tried this aswell. I see a command prompt window open and close but the default ntuser.dat remains untouched. Which is why I posted the batch file just incase there was a mistake in it. Will this run with admin privledges?

It is possible that the .reg file is not putting the settings in the correct location inside the mount, but I can only guess without actually seeing it.

Yes it runs with admin privileges.

Here is a snip I have been posting to people looking into default profile changes. You already grasp Ogatat's method, but you may want to check out the TechNet Link

To make the change in your Default User Profile, you could try this method.

See post #9 from ogatat for more details.

TechNet Link

If you mount your WIM with DISM, you can make the change permanent and not need to run a script at all.


You might have better luck following section B and instead making your changes to the Administrator account and using CopyProfile setting during sysprep

http://support.micro....com/?id=973289

Edited by MrJinje, 07 January 2010 - 12:16 PM.


#5
imbecile29

imbecile29
  • Member
  • 6 posts
  • Joined 06-November 04
--Reg File
Windows Registry Editor Version 5.00

[HKEY_USERS\zzz\Software\Microsoft\Windows\CurrentVersion\RunOnce]
"CreateMyPicMyMusic"="rundll32 mydocs.dll,PerUserInit"

[HKEY_USERS\zzz\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders]
"Personal"="D:\\%USERNAME%\\My Documents"
"Desktop"="D:\\%USERNAME%\\Desktop"
"Favorites"="D:\\%USERNAME%\\Favorites"
"My Pictures"="D:\\%USERNAME%\\My Pictures"
"My Music"="D:\\%USERNAME%\\My Music"
"My Video"="D:\\%USERNAME%\\My Videos"

[HKEY_USERS\zzz\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders]
"Desktop"=hex(2):44,00,3a,00,5c,00,25,00,55,00,53,00,45,00,52,00,4e,00,41,00,\
  4d,00,45,00,25,00,5c,00,44,00,65,00,73,00,6b,00,74,00,6f,00,70,00,00,00
"Favorites"=hex(2):44,00,3a,00,5c,00,25,00,55,00,53,00,45,00,52,00,4e,00,41,00,\
  4d,00,45,00,25,00,5c,00,46,00,61,00,76,00,6f,00,72,00,69,00,74,00,65,00,73,\
  00,00,00
"Personal"=hex(2):44,00,3a,00,5c,00,25,00,55,00,53,00,45,00,52,00,4e,00,41,00,\
  4d,00,45,00,25,00,5c,00,4d,00,79,00,20,00,44,00,6f,00,63,00,75,00,6d,00,65,\
  00,6e,00,74,00,73,00,00,00
"My Pictures"=hex(2):44,00,3a,00,5c,00,25,00,55,00,53,00,45,00,52,00,4e,00,41,\
  00,4d,00,45,00,25,00,5c,00,4d,00,79,00,20,00,44,00,6f,00,63,00,75,00,6d,00,\
  65,00,6e,00,74,00,73,00,5c,00,4d,00,79,00,20,00,50,00,69,00,63,00,74,00,75,\
  00,72,00,65,00,73,00,00,00
Here is the registry file i'm trying to import.

I'm already using the <CopyProfile>true</CopyProfile> in my unattended file to copy settings to the default profile but I thought that these tweaks wouldn't work because it would copy the currently logged in profile which would cause the default profile to have a static values and all new users would be pointing to the same desktop, my documents folders etc. But I may be wrong about this; this is just what I assumed would happen. Hope this makes sense.

#6
MrJinje

MrJinje

    Tool™ Developer

  • Developer
  • 1,051 posts
  • Joined 14-October 09
  • OS:Server 2012R2
  • Country: Country Flag
Did you notice that you are mounting your hive to

hku\default

but your registry files is merging into

HKEY_USERS\zzz

Can you check the regedit on a failed installation and see if the ZZZ setting is being pushed, if so, change your mount point to this and see if that helps.

start /wait reg load "hku\zzz" "C:\Users\Default\NTUSER.DAT"


Edited by MrJinje, 12 January 2010 - 10:59 PM.


#7
imbecile29

imbecile29
  • Member
  • 6 posts
  • Joined 06-November 04
Thanks MrJinje for your quick replies.
I have recreated everything (Unattend.xml, Regtweak, Setupcomplete.cmd) hence the change from "default" to "zzz" thought maybe naming it default might be an issue. Sorry should have mentioned that. I saw someone else’s setupcomplete.cmd file on this site and have changed mine to match and it seems to be working now for some reason here is what I’m currently using.
@echo off
cd\
start /wait reg load "hku\zzz" "C:\Users\Default\NTUSER.DAT"
start /wait regedit.exe /s C:\Windows\Setup\scripts\RedirectDocumentsDesktop.reg
start /wait reg unload "hku\zzz"
exit
The main difference is changing to the root of the drive and instead of using "reg import" using "regedit.exe /s" I don't know if it was this or recreating all the other files but it seems to be working. The one problem I have now is when clicking on your personal folder (click start > Your username) the folders are doubled up eg two desktop, documents, my pictures folders etc. I have seen a post with someone having a similar issue but can't recall where.

#8
Mikka

Mikka

    Junior

  • Member
  • Pip
  • 80 posts
  • Joined 02-March 06
  • OS:none specified
  • Country: Country Flag
Hi,

albeit this is an old thread, I'll dredge it up as I brooded over a similar problem recently.
(I circumvented it by simply modifying the install.wim – appeared to me being the easiest way.)

What I'm interested in:

  • The cd\ command in the second line, what is it good for?
  • Did you experiment with current user settings (going under the HKCU branch) as well?
  • If naming does matter, is there a special reason for loading the hive to hku\zzz?
Regards,
Mikka




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users