1. You are viewing our forum as a guest. For full access please Register. WindowsBBS.com is completely free, paid for by advertisers and donations.

Resolved Using a 2nd HD as a safety net

Discussion in 'Windows XP' started by drhans2, 2012/03/02.

  1. 2012/03/10
    drhans2

    drhans2 Well-Known Member Thread Starter

    Joined:
    2003/09/07
    Messages:
    261
    Likes Received:
    1
    Note... the "rem" did not show correctly in the script example on the previous reply but my script has a rem before each line that I don't want the script to copy..
     
  2. 2012/03/11
    TonyT

    TonyT SuperGeek Staff

    Joined:
    2002/01/18
    Messages:
    9,072
    Likes Received:
    400
    No "." is needed for setting the bvariables.

    Delete a few files that were manually copied and then run the script by double clicking it. You'll likely get a prompt "do you want to allow this..." and put a check in the "never ask again" box. See if the copy takes place.
     

  3. to hide this advert.

  4. 2012/03/11
    drhans2

    drhans2 Well-Known Member Thread Starter

    Joined:
    2003/09/07
    Messages:
    261
    Likes Received:
    1
    I deleted 4 files than ran the script as directed. First time it brought up a dos window and said it was backing up my documents.. Took about 3 seconds.. (On this "test" computer the size of My Documents Folder is only 24 MBs with only 26 folders & 37 files.)

    I then went to the "G:\" drive and did not see any of the files I deleted or any of new test files I added yesterday.

    I ran the script again by both double clicking on the file and using the "run" cmd window.. both times it flashes thru the dos windows very quickly without any changes to G:\ drive.

    I did not get any options anytime to a prompt asking "do you want to allow this..." and put a check in the "never ask again" box, likewise for any option to "exit" the dos window after running the script.

    Same results when doing a shut down & restarting the computer.
     
  5. 2012/03/12
    TonyT

    TonyT SuperGeek Staff

    Joined:
    2002/01/18
    Messages:
    9,072
    Likes Received:
    400
    Repeat the test and add a pause command in between each command and at the end so you can see the results.
     
  6. 2012/03/12
    drhans2

    drhans2 Well-Known Member Thread Starter

    Joined:
    2003/09/07
    Messages:
    261
    Likes Received:
    1
    I added the "pause" and the results were "0 files copied" after each line of instruction.

    By chance did I misunderstand your example script? Should I have replaced the " %USERPROFILE% " with " my name " and the " %drive% " with the " path " to my documents?

    The next question might be getting ahead of the original task & problem but thought it might be address at the same time if relevant. And I might be over thinking this task...

    If the script is "user defined by the current active user" would there be a problem if a 2nd user is added to the computer?

    Wouldn't the script overwrite the save files of the 1st user's profile when or if a 2nd user were to log on & then shutdown? Same for a "Guest User" logging on?

    I assumed that by just pointing to the root drive if a 2nd user were to added to the computer the script would only save the last user that used the computer.


    Is there a way to point the script to a named folder on the G:\ drive instead of the root drive that would link to any user. Is the Group Policy "Shutdown" independent for each user?
     
  7. 2012/03/13
    TonyT

    TonyT SuperGeek Staff

    Joined:
    2002/01/18
    Messages:
    9,072
    Likes Received:
    400
    1. You must edit the path to your backup drive.

    2. UserProfile is used because it can then be used on any computer easily, that's the only reason.

    3. If another user logs on and runs it, then yes, his files will get copied to the defined path of backup drive.

    4. The destination can be edited to any path. i.e. sub-folders rather than root, just make sure the subfolder actually exists, else it will fail.

    5. Do not use the script at shutdown if have multiple users.
     
  8. 2012/03/13
    drhans2

    drhans2 Well-Known Member Thread Starter

    Joined:
    2003/09/07
    Messages:
    261
    Likes Received:
    1
    I finally was able to manually run the backup.cmd file and have it copy the contents of "My Folder" and its sub folders to the G:\ drive. It did add the two sub folder "My Folders" & "Favorites" & there related "sub folders "..

    I was able to delete some file in the G:\ and again manually run the backup.cmd file. It added the back the files I deleted as it should.

    What I can't do is Shutdown the computer and get the script to run.

    I looked at the Group Policy editor and the "backup.cmd" file is listed in the Computer Configuration, Windows Settings, Scripts (Startup/Shutdown) "Shutdown" folder.

    I keep getting a error window stating that ( MMC has detected a error in a snap-in. It is recommended that you shut down MMC and restart MMC.)

    There are only 3 choices to choose.. the default is continue running and ignore this snap-in error for the rest of this session.

    Report to Microsoft and shut down & Continue running and always ignore.

    I keep the default and most times it closes the MMC window is closed down... (Group Policy Editor window)..

    Some times the window stays open I am able to choose "Add" and I did point it to the backup.cmd file in my C:\.

    I also browsed to the C:\WINDOWS\system32\GroupPolicy\Machine\Scripts\shutdown folder and was able to manually execute the backup.cmd file and have it copy files to the G:\ drive.

    So it looks like the the problem is in the Group Policy Editor program.. The backup.cmd is not getting executing when I shutdown the computer.

    Since I had to use a unorthodox method to install the Group Policy Editor program into Windows XP Home edition is there by chance a different way to enter in the correct instructions at Shutdown?
     
  9. 2012/03/14
    TonyT

    TonyT SuperGeek Staff

    Joined:
    2002/01/18
    Messages:
    9,072
    Likes Received:
    400
    You could try bypassing GPE and add the command to shutdown at the end of the script:

    shutdown -s -t 05 -c "Shutting down the computer in 5 seconds."

    Shutdown

    Create a shortcut to the script, keep it on the Desktop and use it to shutdown the computer instead of the start menu shutdown link.
     
  10. 2012/03/15
    drhans2

    drhans2 Well-Known Member Thread Starter

    Joined:
    2003/09/07
    Messages:
    261
    Likes Received:
    1
    TonyT

    That option worked.. thank you..

    Question..Does that workaround shut down any "Open Programs" or "Programs working in the background" the same way as the "Start" -- "Turn Off Computer "-- "Turn Off Button" works or is it somewhat like "crashing the computer" like when having a power failure??

    Thanks again for your assistance..
     
  11. 2012/03/16
    TonyT

    TonyT SuperGeek Staff

    Joined:
    2002/01/18
    Messages:
    9,072
    Likes Received:
    400
    Add the f switch to force all running background processes to close:

    -f (Forces running applications to close.)

    But you shouldn't need to use it because they will usually close anyway. The advantage of using it is if you forget to close a program such as IE or Word, it will close nicely.
     
  12. 2012/03/18
    drhans2

    drhans2 Well-Known Member Thread Starter

    Joined:
    2003/09/07
    Messages:
    261
    Likes Received:
    1
    TonyT...

    The backup.cmd worked with or without using the -f switch.. I did enter the switch at the beginning as opposed to adding to the end of the instruction line.. Don't know if that matters but it made sense to me in the order of steps to shutdown..

    As far as using the shortcut method over the Group Policy Editor method.. It looks like the shortcut method would be preferred (maybe) if there were more than one user for the computer & the some or all of the other user's wanted to backup there specific "My Documents ", etc. data.. or for sure if you have a "Home Edition of XP "

    I'm thinking you could you have a backup.cmd file for each user & customize each one to point to a specific named folder for that user vie the "set drive variable" ( set drive=G:\Named User ) & then make a different "Named User " folder for each user on the backup drive.

    Place each user's customized backup.cmd file in each respected "My Documents" Folder and put a shortcut pointing to it on each s ones "Desktop ".

    Double click on the shortcut and files copied if needed and the computer will shutdown.

    Would that work?


    Or rethinking the issue.. On XP Pro computers with multiple user's.. is the below option possible?

    I noticed there's a folder for "User\Scripts\Log Off" in the Group Policy Editor.. By chance is there a Log Off folder specific to each user? (Making it a better choice (see below) as opposed to using the "Machine\Scripts\Shutdown" and it being all inclusive, unless of course there is only one user.)

    I wonder if there's a way to point each user backup.cmd to their "Log Off" script , but also remove the "shutdown" instruction as not to Shutdown the computer, only copy their files if needed when they Log Off? That would leaving the Shutdown button to work as Microsoft planned..
     
  13. 2012/03/19
    TonyT

    TonyT SuperGeek Staff

    Joined:
    2002/01/18
    Messages:
    9,072
    Likes Received:
    400
    Yes, you could make separate scripts for each user and copy files to specific user backup directories.

    As for Logoff, I'm pretty sure it's a system wide policy and don't think separate scripts would function there.

    Of course, if have multiple users, you can extend the single script with copy commands for each user, and copy all of the users' files at once. Obviously, if User 1 logs off or uses the shortcut, and later User 2 logs on, and User 2 runs the script, User 1's files have already been copied so the script won't take any longer to complete. None of User 1's files will get copied as none of the files have changed since the last backup.

    But to run the script that contains the commands to copy all user accounts' files, it must be run from an admin account and possibly permissions must be set for the script and certain files. In other words, if all users are in the Administrator group, then User 1 may not be able to copy User 2's files if User 2's files are "private ".

    If use a single script with copy commands for all users, then the exact path must be used in each copy command, e.g.
    Code:
    %backupcmd%  "C:\Documents & Settings\User 1\My Documents"  "%drive%\User 1\My Documents "
    %backupcmd%  "C:\Documents & Settings\User 2\My Documents"  "%drive%\User 2\My Documents "
     
  14. 2012/03/20
    drhans2

    drhans2 Well-Known Member Thread Starter

    Joined:
    2003/09/07
    Messages:
    261
    Likes Received:
    1
    If I understand this correctly with administrators privileges...... If I extend the single script with copy commands for each user.

    Then link the backup.cmd to the "Log Off" in the Group Policy Editor.

    When any user "Log Off" or use's the shortcut you would copy any changed or added files of all of the user's files to there respected folders on G: drive at once. (except any "private" files).

    Code:
    %backupcmd% "C:\Documents & Settings\User 1\My Documents" "%drive%\User 1\My Documents "
    %backupcmd% "C:\Documents & Settings\User 2\My Documents" "%drive%\User 2\My Documents "

    What about the "set drive variable" should it be just--- ( set drive=G:\ )
    Then make folders on the G:\drive as needed -----

    "\User 1\My Documents "
    "\User 2\My Documents "

    and if needed...

    "\User 1\Thunderbird "
    "\User 2\MS Outlet "
    etc

    Question........ When any user... use's the "Start/Turn Off Computer" button does that operation alone "Log Out" (IE run the script) of any or all user's that might be still logged on ?



    Or if there is only one user on the computer ---- just use the Group Policy Editor and the original script linked to the Shutdown button. (or I assume linking to the "log off" would also work )

    Or with Windows XP Home Edition or below (no Group Policy Editor available) make each user's a "folder specific" script and also use the shortcut placed in their profile's folders as opposed to Shutting Down with the Start/Turn off Computer button.
     
  15. 2012/03/21
    TonyT

    TonyT SuperGeek Staff

    Joined:
    2002/01/18
    Messages:
    9,072
    Likes Received:
    400
    If have XP Pro with Group Policy set correctly, the script will run and all commands in it will execute. In actuality though, only the currently logged in user's files that have changed will get copied. Other user's files have not changed since they last logged off and were copied.

    I mentioned the "private files" because when you setup a second account in XP you are prompted if want to "make the user's files private ", meaning other users cannot read them, alter them or write to the user directories.

    Set the drive letter to your actual drive, then create directories there for each user, just as you have in the above post.

    If have Group Policy set to run the script at Log Off, I'm not certain the script will run if use the Start button > Shutdown link. It will run that way if GP is set to run the script at shutdown though.

    If have XP Home, the same single script with all user commands in it can be used, just place the script in the root of the C drive. Then make shortcuts to it and place each shortcut on each user's desktop folder:
    c/docs & settings/user1/desktop
    c/docs & settings/user2/desktop
    c/docs & settings/user3/desktop
    and the shortcut will appear on each user's desktop.

    Instead of shutting down the computer using:
    shutdown -s -t 05 -c "Shutting down the computer in 5 seconds. "

    you can change the command so all it does is log off the current user:
    shutdown -l -t 05 -c "Logging off in 5 seconds. "

    If use the -l switch instead of the -s switch, after log off, the login prompt will be displayed on the screen.
     
  16. 2012/03/23
    drhans2

    drhans2 Well-Known Member Thread Starter

    Joined:
    2003/09/07
    Messages:
    261
    Likes Received:
    1
    TonyT....

    Thanks for assist in choosing the best option to use when "Using a 2nd HD as a safety net" to either a Windows XP Home Edition , XP Pro Edition, Vista or Win 7 single user or multi users computer..

    I think we covered all the bases.. For my single user XP Pro computer the Group Policy backup.cmd script linked to the Shutdown will work just fine & for the multi user XP Home Edition computer... either of the last two options mentioned seem to cover all the bases.

    I'm leaning towards using the shortcut with the option to "Log Off ". That would avoid unnecessary shutdowns between users. However I guess I could, ( just to cover all bases) place a 2nd script called "backup2.cmd" and shortcuts on each users desktop with options to "shutdown ". That way which ever shortcut is used everyone's files are copied. (as applicable)

    Trick now is with a XP Home Edition.. to adapt to using the shortcut as opposed to the Start--Turn Off computer, or Log Off buttons.
     
  17. 2012/03/24
    TonyT

    TonyT SuperGeek Staff

    Joined:
    2002/01/18
    Messages:
    9,072
    Likes Received:
    400
    I've been researching running apps at shutdown in XP Home. Seems the best options are to really get gpedit working in it or use a 3rd party program that intercepts the shutdown event to let you run desired programs prior to shutting down. I found this free app called LastChance.
     
  18. 2012/03/25
    drhans2

    drhans2 Well-Known Member Thread Starter

    Joined:
    2003/09/07
    Messages:
    261
    Likes Received:
    1
    The 2 reviews on "Last Chance " software are not so good... but really not enough feed back to judge, maybe due to its 2005 creation and now XP is current with sp3..

    Have you tried the Group Policy Editor fix from this site in the UK? ( It restores GPedit.msc snap-in for Win XP Home)..... http://robertthompson.me.uk/xptricks/gpedit.htm

    I earlier (post #20) downloaded the zip file and installed as per the instructions in the "Read This.txt" file.

    I got some pop up error notices and then tried to associate the .dll files using the run cmd. Some dll associations succeeded and some did not.

    Maybe I had the trouble due to some registry issue on my xp home edition.. I do use CCleaner or AFT Cleaner more than I need to....
     
  19. 2012/06/11
    iwilldo

    iwilldo Well-Known Member

    Joined:
    2010/09/30
    Messages:
    63
    Likes Received:
    0
    g'day all ,

    have just read the May newsletter , and clicked the link to this subject :

    http://www.windowsbbs.com/windows-xp/102016-using-2nd-hd-safety-net.html

    i see the matter was resolved ,and i would normally leave it that way , however , as a post mortem, may i add that one aspect not covered may be of help to someone .

    that is ,what i do , ie. , i have a second hd to which i regularly totally clone my main drive { both partitions} ,the plan being that if my main drive clunks it , i just rip out the main one and physically change the plugs so that my " clone" then becomes my main drive... then slip out and buy a new 2nd drive ... this is what i feel is the main purpose of a " safety 2nd drive " ... and so far ,fortunately ,have only had to do it once ... but it worked a treat.

    if i just need to replace / repair a partition on main drive , then i can boot from the 2nd drive , and clone just the partition ... similarly can copy files from 2nd to main ...

    apologies for referring to a closed topic ,but thought this could help...
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.