Default Profile Copy Script Guide by Kemp Langhorne
Script by : Brian Davis
Updated January 21, 2007

Introduction:

When you manage lots of computers, there comes a time when you need to redo the default profile quickly. This DOS batch script is the answer. After creating a default profile, simply upload the profile to a network share. Then, run the script on the local computer. The script will prompt you for the name of the room. After entering in the room, the script will connect to the network share, and copy down the correct profile automatically. There are two versions of this script. There is one for Windows XP and the other for Windows Vista. Two scripts are required since the default profile locations have changed in Vista.

Requirements:

A Network Share
This script requires a network share were the default profile data can be stored. The script will mount this network share and copy the profile down from it to the local computer.

The Batch Script, How it Works and How to Use it:

First, create a default profile. This involves logging into the computer, making all the changes you want (background, printers, themes, etc). Next, restart the computer and log into another account besides the one you created the profile with (Windows locks several of the files you need to copy, and that is why we are to restart). Once logged in, copy the contents of c:\\documents and settings\\user (C:\\Users for Vista), replacing "user" with the name of the account you created the profile with, to the network share. You must copy the profile to a room folder\\default user. This room folder\\default user is what the script looks for. For example, after you have created several profiles for different rooms, your network share may contain folders AU102, LE332 and Ge34. Within each of those folders is the default user folder that contains the default profile you create.

Second, open the script. The script will ask you which room you are in. This room number corresponds to the name of the folder on the network share. For example, if you enter in room B102, then the script will access the network share's B102 folder for the default profile. After you enter in a room, the script will begin copying all the data.

Note: Remember, there are two versions. Use the one matching your OS. Also, within your network share room folders, make sure you have a folder called default user. This is what the script will look for.

Windows XP Default Profile Copy Batch Script .bat:

REM Windows XP Default Profile Copy Batch Script
REM Script created by Brian Davis
@echo off
echo.
echo This file will copy the specified Windows *XP* Default User profile folder from a network share to this local computer's Default Profile
echo.
echo.
echo At the prompt, input the room name (Example: Room102)
echo Room Name:
set /p room=
echo Mapping drive to \\\\networkshare\\folder
echo.
REM Change the networkshare to your location
net use V: \\\\networkshare\\folder
echo.
rd /s /q "C:\\Documents and Settings\\Default User\\"
echo.
mkdir "C:\\Documents and Settings\\Default User"
xcopy /s /e /h /k "V:\\profiles\\%room%\\Default User" "C:\\Documents and Settings\\Default User"
echo.
dir "C:\\Documents and Settings\\Default User\\"
net use v: /del /yes
ECHO Done!
Pause

Read the comments inside the code for more information on what part of the script does what.

 

Windows Vista Default Profile Copy Batch Script .bat:

REM Windows Vista Default Profile Copy Batch Script
REM Script created by Brian Davis
@echo off
echo.
echo This file will copy the specified Windows *Vista* Default User profile folder from a network share to this local computer's Default Profile
echo.
echo.
echo At the prompt, input the room name (Example: Room102)
echo Room Name:
set /p room=
echo Mapping drive to \\\\networkshare\\folder
echo.
REM Change the networkshare to your location
net use V: \\\\networkshare\\folder
echo.
rd /s /q "C:\\Users\\Default\\"
echo.
mkdir "C:\\Users\\Default"
echo.
xcopy /T /E /K /H /Y "V:\\profiles\\%room%\\Default" "C:\\Users\\Default"
echo.
dir "C:\\Users\\Default\\"
net use v: /del /yes
ECHO Done!
Pause

Read the comments inside the code for more information on what part of the script does what.