We help IT Professionals succeed at work.
Get Started

VB script to transfer user files between domains

Last Modified: 2012-06-27
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!
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

Open in new window

Watch Question
This problem has been solved!
Unlock 1 Answer and 3 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE