Cuteadder
asked on
VB script to transfer user files between domains
We are about to kick off a big project moving about 200 users between domains, the users will be moved onto a new domain, with a new format of username and a new computer.
I want to use a VB script to move, Desktop & Favorites & My Documents from within Documents and Settings.
Ideally, one vb script on the old computer to be run when logged onto a admin, that will prompt for the username, then move the three above folders to a network share, then prompt when finished.
Then the user logs onto the new computer and off, so that a admin can log on and...
Then another vb script to prompt for the old username and the new username, and then move the three folders back onto the NEW computer and prompt when complete...
I have a little bit of code before, but am not a code guru... please help!
I want to use a VB script to move, Desktop & Favorites & My Documents from within Documents and Settings.
Ideally, one vb script on the old computer to be run when logged onto a admin, that will prompt for the username, then move the three above folders to a network share, then prompt when finished.
Then the user logs onto the new computer and off, so that a admin can log on and...
Then another vb script to prompt for the old username and the new username, and then move the three folders back onto the NEW computer and prompt when complete...
I have a little bit of code before, but am not a code guru... please help!
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set WshShell = CreateObject("WScript.Shell")
RootSource = "D:\Audio\"
RootDestination = "\\some computer name\audio\"
strfolder = InputBox("Please Input folder name:", "Your vbs")
If not objFSO.FolderExists(RootDestination & strfolder) Then
objFSO.CreateFolder(RootDestination & strfolder)
End IF
strcmd = "xcopy """ & RootSource & strfolder & "\*.*"" """ & RootDestination & strfolder & """ /S /Y /E "
'Wscript.Echo strcmd
strCommand = WshShell.Run(strcmd, 0, True)
Wscript.Echo strCommand
Set objFSO = nothing
Set WshShell = nothing
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Yeah I've usmt before, but my personal preference is a clean copy of just the files that the user needs, plus with the users going onto a different domain etc.
Thank you for all your help.
Thank you for all your help.
If you are wanting to move actual user profiles, Microsoft has a nice tool called User State Migration Tool (USMT) that will do this and you can even migrate profiles between operating system versions if the users are going from XP to Vista or 7 on their new computers.
If they are going from XP to Vista or 7 and you just want to use MaxSoullard's script, the User Profile folder path is also going to be different on the different operating systems. I use this little bit of code if my scripts need direct access to non-specific User Profile folders. Replace lines 17 and 68 in MaxSoullard's code above with this attached code:
It will grab the "AllUsersProfile" variable from the local machine and remove the "All Users" part at the end then add the User name from the Input box.
Open in new window