[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now


How to run profile coping batch file before the profile loads in XP and 2000.

Posted on 2007-03-29
Medium Priority
Last Modified: 2013-12-04
I have batch file that will take user input – login name -  and copy files from profile <loginname> to profile <loginname.machinename>.
The question is – how can I run that batch file before the profile <loginname> loads?
I tried including it in wininit.ini -  no go.
Win.ini – also no go -  it loads after the profile is loaded.

User input is important in order to specify the correct source profile.
I need to roll it out on over 500 workstations with XP professional and win2000 operating systems.
I can't trust users to create 3-rd profile and initiate copy this way.
All help and suggestions are greatly appreciated.

Question by:lescluster
LVL 67

Expert Comment

ID: 18817100
I don't believe you'll be able to, and grab input from the user, because the credential context will be that of the SYSTEM account, not a user.  The user won't be able to respond to those prompts until Windows has logged them on..
LVL 63

Expert Comment

ID: 18817115
If you need user input, then it needs to be run after login.

I would do it in a batch file and use the Username variable, and have it copy the profile.
At next login, it should be available.

You may have issues with security depedning if the user is a local admin or not.

You might need to give a little mre detail on what you are trying to accomplish in general, and see if there is a better way.

I hope this helps !

Expert Comment

ID: 18817214
Yeah, a little more information would be useful.  At first glance, this looks like it would be a great opportunity to use roaming/networked profiles.
Transaction-level recovery for Oracle database

Veeam Explore for Oracle delivers low RTOs and RPOs with agentless transaction log backup and transaction-level recovery of Oracle databases. You can restore the database to a precise point in time, even to a specific transaction.


Author Comment

ID: 18817527
OK -  sorry for being so brief and thanks for fast advice. Here is the full scenario:
I had over 500 workstations under domain. Now we are getting away from domain. All users have profiles created on their workstations with the name in the form of username.machinename. The new profiles are empty - or at least they should be empty - meaning just a basic template stuff in there. SO -  when the user logs in with the new login (username.machinename) I would like to have their previous profile that they had when they were under the domain transfered to the new (user.machinename) profile.
Now - the user input issue -  just in case their old profile was not named username but let's say username.domainname - I would like them to specify that for  me before I do the copy. So I copy the right stuff. Perhaps there is other way to detect which profile should be copied -  I am not sure if there is a way to detect the size of the profile (the largest would be the one I want) or some other variable that can be used for the purpose of detecting the correct profile to copy.   I am even willing to abandon the copy process for users that have profiles other then username (presumably previous) and username.machinename (current) profiles on their workstation - if I have to get rid of user input to make it work. I will take care of those manually. Also - before I overwrite the new profile data (username.machinename) I would like to create a copy of that profile and store it on that workstation just in case for some sick reason the profile username.machinename is the loaded profile. Want to avoid destroying it just in case.
I am working primarily in web development so my skills in MS DOS are  somewhat limited -  I would appreciate if you can be as specific as possible in your comments. Thanks much in advance.

Author Comment

ID: 18817557
One more thing -  users have administrative rights.

Author Comment

ID: 18818498
Thanks -  looks like the
is about what I am trying to accomplish. However - Jdeclue says there "Now you have the username available to a script running in the computers startup script, which uses the local system authority to copuy username over username.domain."  Question is - what does he mean by "computers startup script"? How is that going to work if the profile is in use -  exclusive lock will not allow copy to be done successfully.
Any ideas?
LVL 63

Expert Comment

ID: 18818752
I think that you should do this in a logout script via GPO.  That may work.

You are going to have to do some testing.


Author Comment

ID: 18819583
Looks like I found the solution -  will create batch file to get the user name and machine name- set it up on the machine. Then run the copy script that will read that file -  to run the copy script I will use PSExsec : http://www.microsoft.com/technet/sysinternals/utilities/psexec.mspx 

Slight issue that results from my limited knowledge of batch scripting -  I need to echo out the profile directory size  to the netshare location -  can someone help me with teh script for that -  if possible?

LVL 63

Accepted Solution

SysExpert earned 1500 total points
ID: 18819681
use the Dir command.

Post a new Q in the MSDOS TA.

I hope this helps !

Featured Post

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I use more than 1 computer in my office for various reasons. Multiple keyboards and mice take up more than just extra space, they make working a little more complicated. Using one mouse and keyboard for all of my computers makes life easier. This co…
Use this article to create a batch file to backup a Microsoft SQL Server database to a Windows folder.  The folder can be on the local hard drive or on a network share.  This batch file will query the SQL server to get the current date & time and wi…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…

834 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question