Batch Script Help Pls.............

Discussion in 'Scripting' started by ramg1967, Mar 28, 2015.

  1. ramg1967

    ramg1967 MDL Member

    Sep 13, 2012
    138
    15
    10
    Hello All,


    We are replacing Lenovo hardware with Dell. In the process of upgrading 150 users. I would like to use a script that can backup user profile data to USB stick and then use the script to restore backed up data from USB stick onto Dell machine.

    This is what my users will do.

    1. Use the script to backup their data to USB stick
    2. After they get new Dell machine they will run the script to restore the files from the USB stick

    All my users are currently on Lenovo T520 running Windows 7 Entp.

    I am seeking help to create a script because, I do not have any scripting skills/knowledlge to complete above task. Appreciate, if any one can help me here.

    When user run the script it should prompt for USERID, so that only data pertaining to the USERID are backed up. I don't want any other users data backed up.


    Following are the folders/files that the script should backup to USB stick.


    c:\users\xxxxxxx\contacts
    c:\users\xxxxxxx\desktop
    c:\users\xxxxxxx\documents
    c:\users\xxxxxxx\downloads
    c:\users\xxxxxxx\favorities
    c:\users\xxxxxxx\links
    c:\users\xxxxxxx\music
    c:\users\xxxxxxx\pictures
    C:\users\xxxxxxx\appdata\roaming\microsoft\signatures
    C:\users\xxxxxxx\appdata\roaming\microsoft\sticky notes
    C:\users\xxxxxxx\appdata\local\microsoft\outlook - (I just want only the PST files)


    Is it possible to help me in creating a script to backup and restore the data.


    All my users have 64GB USB stick. They will use USB stick to backup the data using the script and use the script to restore (from the USB stick back to c:\users) after, I give them DELL machine with Windows 7 and all apps installed.


    Thanks and look forward to your help.


    Ram
     
  2. pisthai

    pisthai Imperfect Human

    Jul 29, 2009
    6,821
    2,005
    210
    As it seems to be that it's part of your income, means you're providing pro services, you should have the knowledge of How To.......!

    That said, I wouldn't teach anybody how is in the service business for to create income. But I would like to give you some hint: Download the free version of MacroToolworks and take the time to teach your self how to create such scripts. It's not to difficult and you should have the technical understanding for to learn fast!
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  3. Chibi ANUBIS

    Chibi ANUBIS MDL Chibi Developer

    Apr 28, 2014
    729
    404
    30
    #3 Chibi ANUBIS, Mar 28, 2015
    Last edited by a moderator: Apr 20, 2017
    Hello you can use XCOPY :) https://technet.microsoft.com/fr-fr/library/cc771254(v=ws.10).aspx
    Example for backup files :
    Code:
    XCOPY /q "%userprofile%\documents" "%~dp0Backup\Documents" /s /e /i
    For restore files
    Code:
    XCOPY /q "%~dp0Backup\Documents" "%userprofile%\documents" /s /e /i

    For Outlook
    Code:
    XCOPY /q "%userprofile%\appdata\local\microsoft\outlook\*.pst" "%~dp0Backup\Outlook" /s /e /i
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  4. leebo_28

    leebo_28 MDL Senior Member

    Jun 12, 2011
    460
    170
    10
    #4 leebo_28, Mar 28, 2015
    Last edited: Mar 28, 2015
    Post your question here for scripting help..

    p.s... pay no attention to the other monkey's post

    p.s.s.. Thanks Chibi ANUBIS! Didn't want the OP to go away discouraged.
     
  5. Mr.X

    Mr.X MDL Guru

    Jul 14, 2013
    5,858
    13,404
    180
    You won't help someone asking for help only because he is going to create income. Hmm, that's pretty weird.
    I have acquired a lot of knowledge here at MDL precisely for my job, which it happens to: create income!
    I mean what is MDL forums for? Isn't just to get knowledge about computers independently what you do with that information?
    And I'm pretty sure I'm not alone... :g:
     
  6. Palladin

    Palladin MDL Senior Member

    Feb 1, 2014
    332
    139
    10
  7. Mr.X

    Mr.X MDL Guru

    Jul 14, 2013
    5,858
    13,404
    180
  8. pisthai

    pisthai Imperfect Human

    Jul 29, 2009
    6,821
    2,005
    210
    I do believe that it differs a bit if you like to make a bit money just with an 'hobby' instead of an pro services. For to doing pro services, I should have some knowledge already, a bit more than an average user has. In Reality, many users on this forum like to ask other to do the work for them instead of doing it on their own. Even if you show them 'just' the way how to, they will still expect the whole things done for them, not do on their own! There's some speech like: "Why I should do the work, why other do it for me free?" Easy way, isn't it?!

    My company is doing such services and all my employees have that bit knowledge above the average users knowledge. How they get it? From real learning which requires quite a bit of own initiative, for sure more that just others on an Forum to ask for the 'How To....'! That's exactly why i shown a way to start with the 'How To....'!

    I had posted many times on this forum what may be works for some problems. And I received many times answers which were everything but appropriate! That even were gone often into personally insulting and abusing. One of my hand it's much enough for to tell how many times I asked for help, on this forum! Same members who were question what I'd done, was send PM' and asked for the software I was talking about and using! Since some time I just delete such PM's and sure didn't answer! Why I should? To get even more insulted etc?! Look at the post in this thread of that member who also has monkey's as his picture and his speech about my post! I all times refrain from to attacking people in any means and try to be polite and objective as possible. "Never do to others, what you didn't like they do to you!"

    I don't post much for some time now, but I'll never hide my real thinking and will speak that out all times, liked or not liked. If I just had posted my answer without to show a way of 'How To.....', that would had been unfriendly! And my post were not without to show a way out of his problem.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  9. Mr.X

    Mr.X MDL Guru

    Jul 14, 2013
    5,858
    13,404
    180
    Okay... fair enough.:)
     
  10. ramg1967

    ramg1967 MDL Member

    Sep 13, 2012
    138
    15
    10
    This is in response to pisthai. I am not offering pro service or a consultant or going to make money out of this project. I am helping the company where, I just performed iPhone 6 rollout and they were happy with my performance. Hence the I T Support Manager approached me and asked, if, I can help them with a script that would help them with the rollout.

    By the way, I am in I T for some time and, I try to get all the help from Google before, I post any request anywhere on the NET. Please note nobody has absolute knwoledge on everything in I.T. It is a procees of learning and moving forward.

    in fact after posting above request, I was able to get a sample PS script from TechNet forum and, I am working on it on how to get the script work the way, I want.

    I want to thank others who have posted positive response and, I will definitely look into and get the script ready. I will be more than happy to share the script here for anybody to use later.
     
  11. pisthai

    pisthai Imperfect Human

    Jul 29, 2009
    6,821
    2,005
    210
    I'll not set your answer in question, just tell, that your initial post were looking as I posted. Anyway, true or not, it's simply impossible to prove on the internet.

    Sure, everything, from the day of birth till the day we pass the way, is a never ending cycle of learning. I classify my self as imperfect and like to be just that!

    As there many ways to get to your destination, it's a fact an normal human intention to find the most easy way to go! That's maybe OK often but all times. In fact, many times the easy one isn't the best way! Special if it comes to the financial foundation of our lives, we should work out the 'How To ....' and not relay on the experiences and knowledge of others. OK, maybe I'm to old and the time I was going to school were completely different form this generation, so I didn't understand or have problems to understand the way the humans of this generation go. But the basics of life are not changed, or just very little.

    Never mind, I always try to solve my problems myself without to use others. I would not take something as it's presented to me, without to check WHY I should use that and crosscheck those information in sight of several aspects. As I've to teach my stuff, I try to push them all times to take the way of learning and not just of taking from others. If I look how long my stuff is now working for my company and therefore for me, which is the youngest 7 years and the oldest 23 years, I do believe that I'm going just the right way.

    Unfortunately, in the Cyber World of Internet, may things differs from the normal and daily life. A lot has an bad impact on the people. Even the information highway simplifies many things and there 99.9% of all needed infos are available, just need to be found, the same Internet isn't the best for the users at all! Many people may wouldn't understand what I'm meaning and such discussion is most time totally useless, here maybe too!

    Anyway, anything what I wrote wasn't mean personally or an insult etc.!
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  12. Flipp3r

    Flipp3r MDL Expert

    Feb 11, 2009
    1,529
    655
    60
    @ pisthai, M8, if your not willing to help the guy out with his question than why even bother replying? End result is pages of useless crap. Let's just end this pointless discussion now.