Jump to content

Rename old "Documents and Settings" during install


Recommended Posts

Hi! Here's the situation:

I've got a unattended Windows XP installation CD that installs everthing on c:, except the "Documents and Settings" folder. This is created on D: by this tring in winnt.sif.

[GuiUNattended]

ProfilesDir = "d:\Documents and Settings"

My problem is when there already exist a "Documents and Settings" folder on D:with the same users as the ones on my installation CD .

I then get foldername like User1.XP2600 (where XP2600 is the machine name) and All Users.WINDOWS.

I tried to rename the old "Documents and Settings" folder to ""Documents and Settings.OLD" with "DetachedProgram" in winnt.sif, because this runs before the new "Documents and Settings" folder is created (At T-39). Am I right? It didn't work. Guess it's because I don't have the rights to this or something...??

DetachedProgram="%systemdrive%\install\batch.cmd"

Batch.cmd:

@echo off

ren "D:/Documents and Settings" "Documents and Settings.OLD"

My final goal is to copy all the stuff from the old user folders to the new ones.

Can anyone help me??

Link to comment
Share on other sites


Not A 100 percent but It should be this maybe

DetachedProgram="%systemdrive%\install\batch.cmd"

DetachedProgram="%systemdrive%\install\batch.bat"

Old Batch

@echo off
ren "D:/Documents and Settings" "Documents and Settings.OLD"

New Batch

@echo off
if exist "D:\Documents and Settings" ren "D:\Documents and Settings" "DocSettingBak"

Hope This Helps

Link to comment
Share on other sites

Thanks Felix!

Looks like this is what i'm looking for.

But can you tell me when this is going to be run..? And where to put the required 3rd party utilities for the batch to work. Didn't figure that out by myself.

Thanks!

Link to comment
Share on other sites

Thanks Felix!

Looks like this is what i'm looking for.

But can you tell me when this is going to be run..? And where to put the required 3rd party utilities for the batch to work. Didn't figure that out by myself.

Thanks!

ok this runs when a user logs on after an upgrade or rebuild. The best place for it is in the default user NTUSER.DAT hive under HKCU\Software\Microsoft\Windows\CurentVersion\RunOnce

If you want to know how to add commands to the NTUSER.DAT hive during unattended installs - have a look at he link at the bottom of my signature. read the guide carefully and you will find out how to do this safely.

If you want some more help let me know.

The 3rd party utils - just put them in %systemdrive%\windows\system32 then they will run from anywhere.

Link to comment
Share on other sites

Try This As A Test

Only If You Have 2 Or More Partitions

Copy Your Doc And Setting To A Empty

Partition.

Run This Script

The Script Function Is To Change These 5 Folders

Documents and Settings\All Users
Documents and Settings\Default User
Documents and Settings\LocalService
Documents and Settings\NetworkService
Documents and Settings\

To This

DocSettingBak\AllUserBak1
DocSettingBak\DefaultUserBak1
DocSettingBak\LocalServicerBak1
DocSettingBak\NetworkServiceBak1
DocSettingBak

For Testing I Added A Repair Option That Just

Renames Them Back To The Defualts Edit The script To Your needs.

Orange Is What Can Be Removed Or Left In

Red Do Not Edit Unless You Know What You Are Doing

echo off

cls

color F3

attrib -s -h -r "%CD%\Documents and Settings"

:Menu1

cls

Mode Con: Cols=55 Lines=7

color F3

attrib -s -h -r "%CD%\Documents and Settings"

Echo.

echo Type Yes  To Rename Documents and Settings 

echo Type R1   If You Ran This Before And Want Set

Echo           The Names To Defualt

Echo Type Quit Exit

set /p select=   Waiting-^>

IF NOT '%select%'=='' SET select=%select:~0,4%

IF /I '%select%'=='Yes' GOTO Rename1

IF /I '%select%'=='Quit' GOTO Quit

IF /I '%select%'=='R1' GOTO Repair1

IF /I '%select%'=='Q' GOTO QUIT

IF /I '%select%'=='select' GOTO OPS

:OPS

cls

color B2

Mode Con: Cols=55 Lines=3

color b2

Echo.

Echo    %select%

Echo Was Not A Valid Type Reply Again!

ping -n 2 127.0.0.1>nul

goto Menu1

:Rename1

attrib -s -h -r "%CD%\Documents and Settings"

if exist "%CD%\Documents and Settings\All Users\" ren "%CD%\Documents and Settings\All Users" "AllUserBak1"

if exist "%CD%\Documents and Settings\Default User\" ren "%CD%\Documents and Settings\Default User" "DefaultUserBak1"

if exist "%CD%\Documents and Settings\LocalService\" ren "%CD%\Documents and Settings\LocalService" "LocalServicerBak1"

if exist "%CD%\Documents and Settings\NetworkService\" ren "%CD%\Documents and Settings\NetworkService" "NetworkServiceBak1"

if exist "%CD%\Documents and Settings\" ren "%CD%\Documents and Settings" "DocSettingBak"

mkdir "%CD%\Documents and Settings"

:Menu2

cls

Mode Con: Cols=55 Lines=7

color 1f

Echo.

echo Type Yes To Rename Them Back To Defualt

Echo Type Quit Exit

set /p Repair=   Waiting-^>

IF NOT '%Repair%'=='' SET select=%select:~0,4%

IF /I '%Repair%'=='Yes' GOTO Repair1

IF /I '%Repair%'=='Quit' GOTO Quit

IF /I '%Repair%'=='select' GOTO OPS1

:OPS1

cls

color B2

Mode Con: Cols=55 Lines=3

color b2

Echo.

Echo    %select%

Echo Was Not A Valid Type Reply Again!

ping -n 2 127.0.0.1>nul

goto Menu2

:Repair1

if exist "%CD%\Documents and Settings" Rmdir /s /q "%CD%\Documents and Settings" Goto R2

if not exist "%CD%\Documents and Settings" Goto R2

:r2

if exist "%CD%\DocSettingBak\" ren "%CD%\DocSettingBak" "Documents and Settings"

if exist "%CD%\Documents and Settings\AllUserBak1\" ren "%CD%\Documents and Settings\AllUserBak1" "All Users"

if exist "%CD%\Documents and Settings\DefaultUserBak1\" ren "%CD%\Documents and Settings\DefaultUserBak1" "Default User"

if exist "%CD%\Documents and Settings\LocalServicerBak1\" ren "%CD%\Documents and Settings\LocalServicerBak1" "LocalService"

if exist "%CD%\Documents and Settings\C:\Documents and Settings\NetworkServiceBak1\" ren "%CD%\Documents and Settings\NetworkServiceBak1" "NetworkService"

:Quit

attrib +s "%CD%\Documents and Settings"

goto EOF

exit

I Have Tested This On C:\, D:\, H:\, L:\ Drives

Edited by gunsmokingman
Link to comment
Share on other sites

hmm.. :}

I't won't work. I must be doing something wrong.

Would you mind giving me a detailed description on how to do this.

I would be very thankful.

Hope this isn't to much trouble.

Are you working from a Unattend installation point of view or manual installation?

Link to comment
Share on other sites

Hi!

I've been trying out different soulutions the past few days, but i'm not there yet. :}

gunsmokingman:

tried your command-file. Did some modification so that I could run it as DetachedProgram. Also had to add "/D" to the attrib command.

But it won't work. Can't figure out why. Works fine when I test it, but not during install... :}

`Felix`:

Thanks for your help so far. Got your program working. Don't know happened the first time I tried it. Must have been to tired or something. This was just what I was looking for.

There's just one problem. When I do a install, the "Default Users" folder already exist. The installer then creates "Default Users.WINDOWS".

My command file loads and unloads the NTUSER.DAT hive in "Default Users" (when it should be using "Default Users.WINDOWS".

I tried renaming the old folder with DetachedProgram launched from winnt.sif. (used gunsmokingmans tips), but as I've allready said it didn't work.

Any tips???

Link to comment
Share on other sites

`Felix`:

Thanks for your help so far. Got your program working. Don't know happened the first time I tried it. Must have been to tired or something. This was just what I was looking for.

Glad to hear it worked for you :)

There's just one problem. When I do a install, the "Default Users" folder already exist. The installer then creates "Default Users.WINDOWS".

My command file loads and unloads the NTUSER.DAT hive in "Default Users" (when it should be using "Default Users.WINDOWS".

I tried renaming the old folder with DetachedProgram launched from winnt.sif. (used gunsmokingmans tips), but as I've allready said it didn't work.

Any tips???

It is still a work in progress and i have so far only worked on the current user... i will be adding the default user and all users to this. Over the next few days i plan to get back to working on this... stay tuned will post updates as they become available. What i really need is someone that knows VB so we can get this into an application when finish :)

Link to comment
Share on other sites

There's just one problem. When I do a install, the "Default Users" folder already exist. The installer then creates "Default Users.WINDOWS".

My command file loads and unloads the NTUSER.DAT hive in "Default Users" (when it should be using "Default Users.WINDOWS".

I tried renaming the old folder with DetachedProgram launched from winnt.sif. (used gunsmokingmans tips), but as I've allready said it didn't work.

Any tips???

Should have an all in one solution for this later this afternoon or tomorrow morning... am just doing some final testing and tweaking. :thumbup

Stay tuned to this link MSFN -> Duplicated User Accounts... :yes:

Link to comment
Share on other sites

  • 2 weeks later...
Should have an all in one solution for this later this afternoon or tomorrow morning... am just doing some final testing and tweaking.

Are you having problems Felix?? Anything I might help you with??

Link to comment
Share on other sites

Should have an all in one solution for this later this afternoon or tomorrow morning... am just doing some final testing and tweaking.

Are you having problems Felix?? Anything I might help you with??

Hi ya,

yep did have some problems which are all sorted bar one. I should have something to post in the next day or so... It's looking very good though :thumbup

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...