Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

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

Posted on 2011-03-16
20
Medium Priority
?
1,221 Views
Last Modified: 2012-05-11
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
0
Comment
Question by:Jaime Campos
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 11
  • 9
20 Comments
 
LVL 22

Expert Comment

by:Joseph Moody
ID: 35151080
Why not use the "Move Contents of Documents to New Location" in the folder redirection options?
0
 
LVL 1

Author Comment

by:Jaime Campos
ID: 35151110
I was hopping to do a logon script that can automate this move. Worst case scenerio, i'll manually change as you suggested.
0
 
LVL 22

Expert Comment

by:Joseph Moody
ID: 35151123
The move contents setting actually does what you are wanting. And it is fully functional back to Windows 2000.
0
Creating Active Directory Users from a Text File

If your organization has a need to mass-create AD user accounts, watch this video to see how its done without the need for scripting or other unnecessary complexities.

 
LVL 1

Author Comment

by:Jaime Campos
ID: 35151131
Wouldn't I need to manually do it on every system?
0
 
LVL 22

Expert Comment

by:Joseph Moody
ID: 35151142
Before we go any further, are you using folder redirection within group policy?
0
 
LVL 1

Author Comment

by:Jaime Campos
ID: 35151152
no, it proved to be too complicated for me to get working.
0
 
LVL 22

Expert Comment

by:Joseph Moody
ID: 35151165
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.
0
 
LVL 1

Author Comment

by:Jaime Campos
ID: 35151216
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?
0
 
LVL 1

Author Comment

by:Jaime Campos
ID: 35151333
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.
0
 
LVL 1

Author Comment

by:Jaime Campos
ID: 35152038
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.  Users permissions
What is the proper way to take ownership once I redirect everyones "My Documents"?

Thanks,

nimdatx
0
 
LVL 22

Expert Comment

by:Joseph Moody
ID: 35156635
In the folder redirection options, uncheck "Grant the user exclusive access"

0
 
LVL 1

Author Comment

by:Jaime Campos
ID: 35157293
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?
0
 
LVL 22

Expert Comment

by:Joseph Moody
ID: 35157317
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 
0
 
LVL 1

Author Comment

by:Jaime Campos
ID: 35157411
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.
0
 
LVL 22

Expert Comment

by:Joseph Moody
ID: 35157421
You set permission manually for the 40 users. Use the link above to set permission on the share and ntfs permission on the folder.
0
 
LVL 1

Author Comment

by:Jaime Campos
ID: 35157450
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$$.
0
 
LVL 1

Author Comment

by:Jaime Campos
ID: 35157475
Do I still uincheck Grant users exclusive rights?
0
 
LVL 22

Accepted Solution

by:
Joseph Moody earned 2000 total points
ID: 35157511
You do still need to uncheck "grant users..." For the 40 users, seize control. Then go back and add the permissions that are in the link. Make sure they have full control that propagates down to each file.

It is not a problem at all! I'm always willing to help!
0
 
LVL 22

Expert Comment

by:Joseph Moody
ID: 35157763
Good link! Thanks!
0

Featured Post

Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article provides a convenient collection of links to Microsoft provided Security Patches for operating systems that have reached their End of Life support cycle. Included operating systems covered by this article are Windows XP,  Windows Server…
Wouldn't it be nice if objects in Active Directory automatically moved into the correct Organizational Units? This is what AutoAD aims to do and as a plus, it automatically creates Sites, Subnets, and Organizational Units.
To efficiently enable the rotation of USB drives for backups, storage pools need to be created. This way no matter which USB drive is installed, the backups will successfully write without any administrative intervention. Multiple USB devices need t…
This tutorial will show how to configure a single USB drive with a separate folder for each day of the week. This will allow each of the backups to be kept separate preventing the previous day’s backup from being overwritten. The USB drive must be s…
Suggested Courses

604 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question