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

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.

Who is Participating?
use the Dir command.

Post a new Q in the MSDOS TA.

I hope this helps !
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..
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 !
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

PhamundaIT Systems Cyber Security EngineerCommented:
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.
lesclusterAuthor Commented:
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.
lesclusterAuthor Commented:
One more thing -  users have administrative rights.
lesclusterAuthor Commented:
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?
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.

lesclusterAuthor Commented:
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 : 

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?

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.