locked
Automated copying of C:\Users (Vista/7) or C:\Documents and Settings (XP) RRS feed

  • Question

  • I am at my wits end.  I have tried VB, Batch, everything I can think of to try to automate copying an entire users or d&s folder for backing up data from a customer's computer to a separate drive before a wipe&reinstall.  Unfortunately, nothing appears to work correctly to bypass the permissions issues.  I have tried downloading and using xcacls and all the other suggestions regarding batch file use, and while it seems to work at first, it will often end the xcopy/robocopy when it encounters individually protected files like DrWatson.dmp and the like, even with /C.  Using VB, I have tried invoking every rights-manipulating bit of code I can think of, and cannot get this automated.  I have tried from 2000, XP, Vista, and W7.  If I cannot find a solution soon, desparation may drive me to trying Turbo Pascal!  Help me out here folks!  VB6 seems to get the closest, but still hits issues with a few files, but I can work in VB.Net (although I'm not as good with it, I mostly just invoke the Scripting resource to use things like FileSystemObject occassionally in VB6), VB6, Delphi, TP, standard batch, and HTML (although i don't see that helping here).  I'm a quick learner though, and if you tell me I need to learn another language to do this, I'll do so, as this is a MUST COMPLETE project.

    Thanks so much in advance,
      -Joel
    Wednesday, August 5, 2009 4:46 AM

Answers

  • net localgroup "Backup Operators" /add %username%
    • Proposed as answer by CraigLieb Sunday, January 10, 2010 8:16 PM
    • Marked as answer by CraigLieb Sunday, January 10, 2010 8:50 PM
    Thursday, August 6, 2009 4:24 AM

All replies

  • Hi Joel

    Have you tried using robocopy using a user account that is a member of the backup operators group on the system so you can bypass the ACL's? If you haven't tried robocopy (part of the windows 2003 resource kit tools) then download it here:

    http://www.microsoft.com/Downloads/details.aspx?FamilyID=9d467a69-57ff-4ae7-96ee-b18c4790cffd&displaylang=en

    Cheers

    Matt :)

    Wednesday, August 5, 2009 4:52 AM
  • No, I hadn't tried that yet.  In this case, I have a "transfer machine" to which I am connecting a customer's HDD to copy prior to a wipe & reinstall.  Using that backup user, would that bypass all the securities on the customer's hdd? Or would that simply work if I'm trying to copy profile directories from the local machine?  I basically need a one-batch-fits-all with which I can effect these data extractions to a folder, move the HDD back to the customer's computer, start the reprogramming, rename and clean the data while installing Windows, and then move the HDD back to the transfer machine and copy the data to the appropriate folders, without having to pick through folders like I do now.  Even trying to copy some of these from within Windows Explorer as an Administrator can have issues with folders like Adobe under AppData, or always with DrWatson.  Blah to Watson. 

    Anyhow, you mention backup operators...  Is this a profile type I'll have on a standard Professional/Business flavored Windows?  Or am I going to have to bite the bullet and run this on a server platform?

    Thanks for your response, this is the only forum on which I've received a reply to this question.  I love TechNet!
      -Joel
    Wednesday, August 5, 2009 8:25 PM
  • Hi Joel

    This is really outside the scope of this scripting forum but i'll offer a few suggestions for you to look at. What operating systems are you migrating to? Microsoft already have several tools to assist in the migration of desktop operating systems:

    http://www.microsoft.com/windows/windows-vista/features/easy-transfer.aspx
    http://technet.microsoft.com/en-us/library/cc722032(WS.10).aspx
    http://support.microsoft.com/default.aspx/kb/321197

    "Backup Operators" is just a local group installed by default on your operating system (xp, vista etc) if your not sure how to configure this...here are some basic instructions.

    Right Click "My Computer" and Select "Manage"
    Expand "Local Users and Groups" and click "Groups"
    Right click "Backup Operators" and select "Properties"
    Click "Add" to add either a local or domain user or group to the local "Backup Operators" group.

    As per the groups description "Backup Operators can override security restrictions for the sole purpose of backing up or restoring files"

    If you just want to take a backup of the user's data then you could just use "ntbackup.exe" to backup to a network drive or use robocopy.exe. Your other option is to take a system image using third party tools, symantec ghost etc. I suggest using the tools microsoft already provides rather than trying to reinvent the wheel.

    Hope this helps

    Cheers

    Matt :)
    Wednesday, August 5, 2009 11:41 PM
  • Adding my profile to the Backup Operators group did the trick.  Still can't do it via VB, but worst case, I can just have VB generate an appropriate batch file and execute it (I'm trying to avoid commonly infected files that aren't really necessary anyway (such as temp under application data).  Xcopy and Robocopy both worked after the change to user settings, thank you so much for that! 

    I'm a little rusty on some of the system command line functions, while we're on the subject, how can I use "net use" to add, and subsequently remove a user from the Backup Operators group?  I eventually want this package to be able to be used for all technicians in a shop, and I think it'd be better to have it work dynamically like that, as finding a bench technician that is good enough to last, and unmotivated enough to stay put for long, is hard to find.  I'd like to basically have the user type added for long enough to execute the commands, then remove them after the job is done, automatically.

    What are the advantages of robocopy vs. xcopy?  They seem to do the same job.  The only difference I can seem to find is that robocopy has to be downloaded to a local machine.  There must be some reason for it though.  I'm sorry if I seem to be asking dumb questions, but I've been more of a general tech and representative for so long, I've gone rusty on all the coding and batching.  ____, when I left my software engineering job, VB and Delphi were at the top of the food chain.  Now I mention VB6 (which was BRAND new), and I get laughed at.  All I can say is THANK GOD for Windows 7's compatibility, and Microsoft finally providing updates for the newer technology to the older OS's, instead of saying "Keep up and buy, or your company folds".  I've never been happier to be a Microsoft Partner.  ____, I have installed W7 on every machine I have, and my old POS Dell runs it better than it ran XP!  They've definitely improved their development team 1000%

    BTW, you have been such a great help, no one else had anything worthwhile to say on the subject, and your first response did the trick 100%.  Thanks a million!  Once again, I love Tech Net!

    -Joel

    Thursday, August 6, 2009 3:06 AM
  • Hi Joel

    The easiest way to add the user to the group in a single command is:

    C:>net localgroup "Backup Operators" /add "Administrator"

    where "Administrator" is the name of the local user you want to add to run the backup process.

    Robocopy.exe comes installed with vista and windows 7 by default. The main difference between using robocopy and xcopy is that robocopy provides far more functionality, for example, logging, retrying, mirroring, copying file permissions etc. If you plan to migrate lots of data, whatever you do, don't use windows explorer to copy files! Use robocopy. You could just create a simple batch file with the net local group and robocopy commands and run that.

    Cheers

    Matt :)
    Thursday, August 6, 2009 3:44 AM
  • Is there a variable I can call to refer to the current user?
    For instance net localgroup "Backup Operators" /add %currentuser% or something similar?

    Thanks
      -Joel
    Thursday, August 6, 2009 4:16 AM
  • net localgroup "Backup Operators" /add %username%
    • Proposed as answer by CraigLieb Sunday, January 10, 2010 8:16 PM
    • Marked as answer by CraigLieb Sunday, January 10, 2010 8:50 PM
    Thursday, August 6, 2009 4:24 AM