locked
How to move all files from a folder for a user to a centralized folder on a core server RRS feed

  • Question

  • Hello,

    I'm curious if there is a batch file that can be made to move the contents that are setup like this....

    I'm having to redo a TS cluster and I'd like to make a batch file script that can be executed that moves the contents of say 'jsmith's local desktop profile @ \\NGTTS1\users\jsmith to a centralized folder on our roaming desktop profile server that saves all of the files for the desktops @ \\NGTFS1\users\jsmith.

    The problem I have is no matter what I tell users to save there files to our Y drive that is a folder that is synced across all 6 of our TS servers, users still store files on there desktops, so as you can imagine if one day they are on one server, then next day they could be on another and there files aren't the same.... hence the reason why I want to move all there files to the centralized server so when I redo the profiles from scratch on the TS server in the farm they suck files from the core server and have all of the files they are used to having.... 

    Now I know I can do this with a MOVE command I've just never done one to this exact.

    Hopefully someone knows the command to move all the contents of one folder on one server to the folder on a different server. I've already got the bulk of the coding done of the .bat script I just don't know this move command:

    would it be this:

    move \\NGTTS1\users\jsmith *.* \\NGTFS1\users\jsmith

    any help would be appreciated, I'm sure this is a easy command to do!

    This is the coding I have so far....

    @echo off
    color 0A
    title Moving Local Profile folder to Centralized Profile Folder on Core Server.
     
    :start
    echo Welcome, %USERNAME%
    echo What would you like to do?
    echo.
    echo 1. Moving Local Profile folder to Centralized Profile Folder on Core Server
    echo. 
    echo 0. Quit
    echo.
     
    set /p choice="Enter your choice: "
    if "%choice%"=="1" goto Move-user-profiles
    echo.
    if "%choice%"=="0" exit
    echo Invalid choice: %choice%
    echo.
    pause
    cls
    goto start
     
     
    :Move-user-profiles
    echo.
    set /p profile="Enter user profile: "
    move "\\NGTTS1\users\%profile%" *.* "\\NGTFS1\users\%profile%"
    echo moving files from local profile folder to FS1 profile server, stand-by...
    echo.
    goto cancel-special 
     
    :cancel-special
    set /p cancel="Type cancel to stop action: "
    if not "%cancel%"=="cancel" exit
    cls
    echo Action is cancelled.
    echo.
     
    pause
    exit

    Sunday, January 12, 2014 7:32 PM

Answers

  • %username% is only available to a user logging in.

    You cannot just move a user folder.  The folder must be moved by the system or the users profile must be updated to reflect the move.

    The user can use the folder move wizard to move their My Documents folder.  There is no equivalent for the Desktop.  You need to use Group Policy to move the Desktop.

    Note that the "Desktop" folder is the folder in the users profile called "Desktop".If you are just asking how to move a folders contents then that is a different question.  It has nothing to do with profiles and TS clusters.

    To move the contents of a foider in a batch file use the "MOVE" command:

    Example:

    move c:\testfolder\*.* x:\targetfolder

    For more help just type "move /?" without the quotes.


    ¯\_(ツ)_/¯

    Sunday, January 12, 2014 8:47 PM

All replies

  • In Windows we would do this using Group Policy.  There is a Policy setting that csn move the Desktop folder to any server you want to move it to.  Once set it will automatically do this for you.

    You should post in the Group Policy forum to find out how we use Group Policy to manage users profiles in Windows.

    You cannot use a script to relocate a users Desktop folder.  The desktop is locked by the time the users logon script is finished running.  It the desktop and profile are already being managed by Group Policy then this can only be done with GP.

    There are also numerous issues associated with deployment and re-deployment that you need to address  Post your questions in the Winows Deployment forum to get assistance with deployment issues.

    Again - want you are asking is not generally possible because of how Windows is designed.  This would only likely work on a simple system or on a stand alone PC and then only under a very limited set of circumstances.

    Use GP folder redirection to do this.  For deployment use Deployment Forum and for TS specific issues post in the RDS forum. 

    All of  this needs to be considered correctly for TS users inn a TS Cluster environment. (TS Cluster?? - not sure what you mean by that.


    ¯\_(ツ)_/¯

    Sunday, January 12, 2014 8:13 PM
  • Note that it is possible to just move only the Desktop folder with GP but you should move all user folders (AddData, Favorites, Documents, etc)  to a central redundant server using GP.


    ¯\_(ツ)_/¯

    Sunday, January 12, 2014 8:16 PM
  • On the contray, the folder is not locked, it's only locked if the users is logged in. I also do think your referring to the roaming profile which is locked. What I'm seeking to do is move the contents of a localized user desktop folder on one of our 6 TS server in our TS farm cluster to the desktop folder of the users on our centrazlied server that stores the default desktop profile in the event the local user profile on the local TS server is deleted.

    The local profile stores aren't locked only the roaming profile stores are locked.... I'd have to brute-force a ownership of a roaming profile for this to happen but I'm not seeking this....

    I'm simply seeking the command to move contents of a folder to another folder on a different host/server on the same network.


    Sunday, January 12, 2014 8:36 PM
  • %username% is only available to a user logging in.

    You cannot just move a user folder.  The folder must be moved by the system or the users profile must be updated to reflect the move.

    The user can use the folder move wizard to move their My Documents folder.  There is no equivalent for the Desktop.  You need to use Group Policy to move the Desktop.

    Note that the "Desktop" folder is the folder in the users profile called "Desktop".If you are just asking how to move a folders contents then that is a different question.  It has nothing to do with profiles and TS clusters.

    To move the contents of a foider in a batch file use the "MOVE" command:

    Example:

    move c:\testfolder\*.* x:\targetfolder

    For more help just type "move /?" without the quotes.


    ¯\_(ツ)_/¯

    Sunday, January 12, 2014 8:47 PM
  • Indeedio fine sir.

    Just looking for the move command and low and behold I was right with the command I just wanted some clarification. :)

    I was merely give background information of what I was doing and why.... I think that's why the answer got mislead. :-P
    Sunday, January 12, 2014 9:07 PM
  • You should still be doing this with Group Policy.  It would save you a lot of headaches later.

    ¯\_(ツ)_/¯

    Sunday, January 12, 2014 9:13 PM