Link to home
Start Free TrialLog in
Avatar of lescluster
lescluster

asked on

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.


Avatar of sirbounty
sirbounty
Flag of United States of America image

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 !
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.
Avatar of lescluster
lescluster

ASKER

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.
 
One more thing -  users have administrative rights.
Thanks -  looks like the
https://www.experts-exchange.com/questions/21113845/Interactive-Script-for-moving-profiles.html
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.

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?

Thanks
ASKER CERTIFIED SOLUTION
Avatar of SysExpert
SysExpert
Flag of Israel image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial