swancd Posted June 13, 2006 Share Posted June 13, 2006 When a customer in our shop needs a reinstall we basically take their HDD out and put it in our machine to copy data off. Most people only want the folders detailed below to be backed up. Looking for help writting a batch file.The batch file needs to do the following.1) Ask for drive letter.2) Ask for Customers Name3) Create a folder on D:\<customer name> 4) Copy the following folders: My Docs, Desktop, Favs, OE E-mails, Address Book, Outlook PST file if there is one.It also needs to copy all user profiles from C:\Documents & Settings\<username>Any ideas how and if this can be done.Thanks Link to comment Share on other sites More sharing options...
Yzöwl Posted June 13, 2006 Share Posted June 13, 2006 Help suggests you already have done some work on this already! What have you got?Also as this is for a business, were you considering payment to the person(s) responsible for helping in the production of this backup solution? Link to comment Share on other sites More sharing options...
TheFlash428 Posted June 13, 2006 Share Posted June 13, 2006 (edited) Well, I won't charge--since chances are you would need to make modifications to this to work for you and also because I'm always willing to try to give back to the MSFN community for all the great stuff I've learned on this board.This is a VBS script I use to do something similar to what your asking (I did make a few 'minor' changes based on your criteria).What it does:asks for a drive letter (I assume you were refering to the drive letter of the files TO BE copied, since you already specify the destination drive letter as 'D:'). asks for Customer name, will create folder, "D:\[customer name]\"asks for profile: specifically the profile from the disk you want to back up (i.e. username). This script will backup one profile at a time and when finished ask if additional profiles need to be backed up.Backups up the following folders to "D:\[customer name]\": (assume 'C' is assigned drive letter).-C:\documents and settings\[profile]\My Documents-C:\documents and settings\[profile]\Favorites-C:\documents and settings\[profile]\Desktop-C:\documents and settings\[profile]\Local Settings\Application Data\Microsoft\OutlookAgain, these are folders I commonly back up, with a few modifications you can edit/add the target destination folders, I may even be willing to help.Copy and save as *.vbsSet objFSO = CreateObject("Scripting.FileSystemObject")strDriveLetter = InputBox("Please enter the desired drive letter","Drive Letter"," ")strCustname = InputBox("Please enter the Customer name","Customer"," ")strFolder1 = "D:\" & strCustnameSet objFolder1 = objFSO.CreateFolder(strFolder1)CopyProfile()i = 0Do strMbox = MsgBox("Would you like to copy another profile?",3,"Hostname")If strMbox = 6 ThenCopyProfile()i = 0Elsei = 1End IfLoop Until i = 1WScript.Quit'subroutine to perform the file backupsSub CopyProfile()strUsername = InputBox("Please enter the profile to copy","Username"," ")strFolder2 = strFolder1 & "\" & strUsernamestrFolder3 = strFolder1 & "\" & strUsername & "\My Documents"strFolder4 = strFolder1 & "\" & strUsername & "\Favorites"strFolder5 = strFolder1 & "\" & strUsername & "\Desktop"strFolder6 = strFolder1 & "\" & strUsername & "\Outlook Data"Set objFolder2 = objFSO.CreateFolder(strFolder2)Set objFolder3 = objFSO.CreateFolder(strFolder3)Set objFolder4 = objFSO.CreateFolder(strFolder4)Set objFolder5 = objFSO.CreateFolder(strFolder5)Set objFolder6 = objFSO.CreateFolder(strFolder6)strTarget3 = strDriveLetter & ":\Documents and Settings\" & strUsername & "\My Documents\"strTarget4 = strDriveLetter & ":\Documents and Settings\" & strUsername & "\Favorites\"strTarget5 = strDriveLetter & ":\Documents and Settings\" & strUsername & "\Desktop\"strTarget6 = strDriveLetter & ":\Documents and Settings\" & strUsername & "\Local Settings\Application Data\Microsoft\Outlook\"On error resume nextSet newFolder3 = objFSO.GetFolder(strTarget3)Set newFolder4 = objFSO.GetFolder(strTarget4)Set newFolder5 = objFSO.GetFolder(strTarget5)Set newFolder6 = objFSO.GetFolder(strTarget6)On error resume nextnewFolder3.Copy(strFolder3)newFolder4.Copy(strFolder4)newFolder5.Copy(strFolder5)newFolder6.Copy(strFolder6)End SubWScript.QuitPS. My scripting knowlege is limited and self-taught--I'm sure there's a simpler way to script this, but I assure you this does work. Edited June 13, 2006 by TheFlash428 Link to comment Share on other sites More sharing options...
Yzöwl Posted June 13, 2006 Share Posted June 13, 2006 Nobody said anything about someone charging someone else. Asking for a fee would be just as rude as not offering one for a service which is only for commercial gain!The questioner asked for help, not someone to do it for them! Link to comment Share on other sites More sharing options...
TheFlash428 Posted June 13, 2006 Share Posted June 13, 2006 Nobody said anything about someone charging someone else. Asking for a fee would be just as rude as not offering one for a service which is only for commercial gain!The questioner asked for help, not someone to do it for them!I apologize if I implied that anyone suggested otherwise...I simply provided a script that I use to accomplish a task similar to what swancd had asked for, hoping it may be of some assistance to his quest to accomplish his goal. Link to comment Share on other sites More sharing options...
swancd Posted June 14, 2006 Author Share Posted June 14, 2006 Big thanks to everyone.Few modifications to get the Address Book & OE Messages and all working good now.Would there be an "easy" way of displaying on the screen in some box or DOS window the files that are being copied.With large files the screen is blank for ages while it copies in the background, would be good to ensure that it was actually copying the files!Big thanks once again! Link to comment Share on other sites More sharing options...
Token Black Guy Posted June 15, 2006 Share Posted June 15, 2006 TheFlash im a noob at this, how would i make it restore the files from the back up?Thank you. Link to comment Share on other sites More sharing options...
TheFlash428 Posted June 15, 2006 Share Posted June 15, 2006 Well, what you'll have is a backup copy on a second drive (you could actually use a network drive as well). Once the drive in question (the bad one), has been rebuilt, the files will have to be transfered back, manually. Perhaps with a few modifications the script could run in reverse? Stand by... Link to comment Share on other sites More sharing options...
swancd Posted June 18, 2006 Author Share Posted June 18, 2006 Guess they could be copied back, but....1) You would need to manually create the Windows XP Users2) Outlook Express Messages would need to be imported.Is this correct ? Link to comment Share on other sites More sharing options...
janus zeal Posted June 19, 2006 Share Posted June 19, 2006 Yes, i dont think that it is possable to make a back up of a user profile, and then restore it. only the documents in the user's folders. Link to comment Share on other sites More sharing options...
swancd Posted June 19, 2006 Author Share Posted June 19, 2006 In addition to this is there anyway of creating an Outlook Express .iaf file using the above script?Looks like you have to manually go to OE -> TOOLS -> ACCOUNTS -> MAIL -> EXPORTWould be nice to include the .iaf file as part of the above data backup script.Thanks in advance. Link to comment Share on other sites More sharing options...
janus zeal Posted June 19, 2006 Share Posted June 19, 2006 Just a bit of advice, you shouldnt assume that every person's computer that you work on will have outlook express as the mail client. Link to comment Share on other sites More sharing options...
swancd Posted June 19, 2006 Author Share Posted June 19, 2006 Appriciate that. What we are trying to do is target "most" people!We will advice that we backup ONLY these files unless otherwise specified. So if users use IncrediMail etc. etc. they will need to tell us so we can do things manually if needed.Then again we could add it to the above script "just in case".Thanks for reply. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now