Question Locked

Master Profile replication

0 helpful
8 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.
Anyone know how to write a script that takes a master profile (eg - C:\Documents and Settings\Master) and copy it's contents to all subfolders of 'Documents and Settings'? This needs to be applied to all existing subfolders of %UserProfile%. Thanks! I've racked my brain and can't figure it out!

8 replies

by markoalleno

Thanks for your reply. I'm trying to take a configuration and have it replicated across several existing profiles. Specifically I have a 2003 Server that I've configured with Terminal Services. I have over 100 users (not concurrenty) that log in with their credentials. In order to keep these profiles uniform, I've created a profile that I want replicated to each of these without having to click over 100 times. A normal situtation would be that I log in as local administrator, then browse to C:\Documents and Settings\Master, and copy all of that folders contents (including hidden and system files). Then I navigate a level up, and choose another user folder (for example C:\Documents and Settings\User1) and paste the contents there so that User1's profile would be an exact clone of Master.
The article (appreciated) you sent me simply shows how to do this using a nice little GUI. The reason for needing to do this as a blanket approach is because when I need to make a change to the Master profile, it takes forever to update all of the other user profiles, and I'd like a script to do the work for me. Thanks!

by rob miners

you are going to introduce problems with accounts if you go the way that you are heading. Where do your users get their profiles from?
Have you thought about Mandatory profiles?

by markoalleno

The problem is not with the profiles themselves. This is a tried and true method that we've been using for over a year now. I have lots of experience with AD, which is where the users get their profiles from. My problem is that I need help with a script that will do this copy function. Thanks for all your help, but do you know how to create this kind of script?

by rob miners

WARNING. This has not been tested. Copy the profile folder to a share on the file server.
Call this from a logon script or just run this bat as a logon. Edit to suit.

%0\..\Name.bat

Name.bat
@echo off
net use n: \\Fileserver\share
:: variables
set drive="C:\Documents and Settings\Default User"
set coprof=xcopy /s /c /d /e /h /i /r /k /y
echo ### Copying Profile...
%coprof% "n:\share\folder" "%drive%\Default User"

by markoalleno

Thanks for the help. I think this is a step in the right direction. However, rather than something being used at logon time, it's something that needs to be run while logged in as local administrator and I don't want to use the Default User method. It seems like it would be such a simple thing to do, but I still can't find a way to do it. Perhaps the best way for me to describe what needs to be done involves forgetting this has anything to do with user profiles.
Let's say I have a folder named "1", within that folder are subfolders named "Master", "A", "B", "C" and so on. I need a script that can detect the number of (and names of) the subfolders of "1" and replicate the contents (including any subfolders) of "Master" to all of it's sibling folders. This way, no matter if there's A-B or A-Z, the script will recognize all other folders and replicate the contentes from "Master".
Again, rrjmin0, I really appreciate your help! Hopefully one of us will be able to figure this out!

by markoalleno

@ECHO ON

for /F %%H in ('dir "\Documents and Settings" /ad/b') do (
xcopy /E /K /O /Y /C /I /Q "D:\Documents and Settings\Master\*.*" "D:\Documents and Settings\%%H\*.*"
)

Of course, when logged in as "Master", the script will attempt to copy the files to it's own directory, and ask if you want to overwrite, or else not copy because of in-use files denying overwrite access. I avoided any user intervention by including the /Y switch for xcopy

This discussion is closed to new replies.