Link to home
Start Free TrialLog in
Avatar of Jaime Campos
Jaime CamposFlag for United States of America

asked on

Need a logon script to move Users MY DOCUMENTS data to a new Fileserver

Hello,

I'm useing a logon script to move my users files and change "My Documents" path to our new Fileserver. All users "My Documents" folder is pathed to \\192.168.1.2\Users\UserN (First name with last initial).  I will be migrating to a new Fileserver with a new Users folder \\192.168.1.173\Users\UserN  (First name with last initial), so I don't want to manually change this on every system, I'd rather run a script. The script below is close but doesn't work on everybody's system. It worked on my system, but seems to not work on any others. I need a script that is flexible enough to make this work. Can someone please take a look at this script and tell me what I may be doing wrong.

@echo off

setlocal
set New_Path=\\server2008\users\%username%
set Old_Path=\\server2003\users\%username%
Set My_Docs=My Documents

xcopy /s /i /y "%Old_Path%\%My_Docs%" "%New_Path%\%My_Docs%"

reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" /v "Personal" /t REG_EXPAND_SZ /d "%USERPROFILE%\%My_Docs%" /f
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" /v "Personal" /t REG_SZ /d "%New_Path%\%My_Docs%" /f

Thanks,

nimdatx
Avatar of Joseph Moody
Joseph Moody
Flag of United States of America image

Why not use the "Move Contents of Documents to New Location" in the folder redirection options?
Avatar of Jaime Campos

ASKER

I was hopping to do a logon script that can automate this move. Worst case scenerio, i'll manually change as you suggested.
The move contents setting actually does what you are wanting. And it is fully functional back to Windows 2000.
Wouldn't I need to manually do it on every system?
Before we go any further, are you using folder redirection within group policy?
no, it proved to be too complicated for me to get working.
Ah. Ok. This makes it a little more difficult. What was too complicated? Folder redirection literally writes to those keys that you have in your script.
Create "Users" share folder on the new server, which will be \\192.168.1.173\Data\Users

Then havefolder redirection policy have it set as " Redirect everyone's folder to the same location"

and

"Create a folder for each user under the root path" and enter \\192.168.1.173\data\Users

Folder redirection will then create the new folder for you with the correct NTFS permissions and redirect their data to this new folder

Is this right?
It worked....on my desktop!!!! I'm going to test with others right now. This just saved me alot of time if it works on others.
ok, some of my users moved over however a couple of users "My Documents" folder says that I don't have permissions to view once on the new fileserver.

I am logging on to new fileserver with a admin account and I still can't access. It's asking me to take owership of the folder before I view.  User generated image
What is the proper way to take ownership once I redirect everyones "My Documents"?

Thanks,

nimdatx
In the folder redirection options, uncheck "Grant the user exclusive access"

I've moved some users already so do I still uncheck that option and what share/security permissions should I apply on the root folder Users?
You can uncheck that if a few users are moved. You will need to set the permission on their folders manually. If a lot have been moved, you may want to set up a new share on the same server.

http://technet.microsoft.com/en-us/library/cc736916(WS.10).aspx 
Just one office with about 40 users moved.

So i uncheck for future users and set permissions the way I want manually on ALL users or just the 40 users that moved.
You set permission manually for the 40 users. Use the link above to set permission on the share and ntfs permission on the folder.
Is there a way I can run a CMD to see what every share/ security permission is set for my old Fileserver, so I can apply to my new Fileserver?

Thanks so much Jmoody10. You saved my a$$.
Do I still uincheck Grant users exclusive rights?
ASKER CERTIFIED SOLUTION
Avatar of Joseph Moody
Joseph Moody
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Good link! Thanks!