Solved Script to change Profile folders's locations

DJDJDJDJ

New member
Local time
12:17 PM
Messages
13
Hi,

At my home, I have a Server 2008 R2 domain with all clients running Win 7. I personally do not like storing user documents and files in the C\User folder as it has a lot of other profile junk in it. I simply create a folder called C\Data and create MyDocs, Music, Download, Videos etc folders in it. After that I manually redirect each type of folders from the current location to these new locations. This allows me to easily backup the required data rather than all the stuff that I don't care for. When profiles get bloated, I simply delete them and then redirect folders from the new profile again. All the data remains in the C:\Data.

All this redirecting can get tedious. I am looking for a script (vb script, batch file, reg file, power shell script) that I can have pre-configured with locations and simply run when I need redirection.

Any help is appreciated.

Thanks
 

My Computer My Computer

Computer type
PC/Desktop
OS
Windows 7 64 bit - Server 2008 R2 (64bit)
Hi DJ...,

Before any script can be made, I'll need you to provide more details about the task you describe. Namely, would you be able to outline the process that you'd take normally; that is, how exactly would you achieve your task the "tedious", manual way?
 

My Computer My Computer

Computer type
PC/Desktop
OS
Windows 10, Windows 8.1 Pro, Windows 7 Professional, OS X El Capitan
Hi,

I create the following folders manually.

C:\Data\User1\MyDocs
C:\Data\User1\Music
C:\Data\User1\Videos
C:\Data\User1\Pics
C:\Data\User1\Download
C:\Data\User1\Favs

Then manually redirect the corresponding folders from C:\Users\User1\.

This seems like an easy enough task if it is one off but if I create a new user, then I have to do this to every PC/Laptop that user will use. Also, about a month or so ago, I had to rebuild my server which mean old user profiles on the user PCs were no longer valid when logging on to the domain. For this reason, I had to do this for each user for every PC/Laptop.

If I can script this, then I can easily modify the script for location and user and simply run it.

Thanks.
 

My Computer My Computer

Computer type
PC/Desktop
OS
Windows 7 64 bit - Server 2008 R2 (64bit)
I have several great books from which, after many hours of trial and error testing, I have learned how to write my own scripts. Would you be interested in learning the process of creating your own scripts which will meet your precise needs?
 

My Computer My Computer

Computer type
PC/Desktop
Computer Manufacturer/Model Number
custom build
OS
Microsoft Windows 7 Ultimate 64-bit 7601 Multiprocessor Free Service Pack 1
CPU
AMD FX(tm)-6100 Six-Core Processor
Motherboard
ASUSTeK Computer INC. M5A78L-M LX PLUS
Memory
4.00 GB
Graphics Card(s)
AMD Radeon HD 6450
Sound Card
(1) AMD High Definition Audio Device (2) Realtek High Defi
Monitor(s) Displays
Toshiba 47ZV650U 47" LCD 240Hz
Screen Resolution
1920 x 1080 x 32 bits (4294967296 colors) @ 60 Hz
Hard Drives
(1) HDT722516DLA380 ATA Device (2) Hitachi HDS721025CLA382 ATA Device (3) ST4000VN000-1H4168 ATA Device (4) Generic STORAGE DEVICE USB Device (5) Generic STORAGE DEVICE USB Device (6) Generic STORAGE DEVICE USB Device (7) Generic STORAGE
PSU
Corsair CX430M
Case
WMI (Waste Management Incorporated)
Cooling
Yes, it's very cool.
Keyboard
Bluetooth KB & Mousepad
Internet Speed
Fios 15/5 and it sucks when Verizon is throttling it down
Antivirus
Avast, MSE and Malwarebytes
Browser
Firefox v.41.0.2 and IE 11
Other Info
2 years old and so far this rig still kicks butt
I don't mind the learning process. I believe I am pretty good with batch and reg files (yep, oldie). I can work with some VB scripts as well. However, I simply do not know where these locations are stored.

(I have no practical experience with Power Shell)
 

My Computer My Computer

Computer type
PC/Desktop
OS
Windows 7 64 bit - Server 2008 R2 (64bit)
I should clarify that I know the location of the folders but I do not know where Windows is storing the information that tell you where these folders are. If I can find that out, then I can probably script it.

I thought about using AutoIT to do this and perhaps use Send Keys but that seems a but too dodgy solution to me.
 

My Computer My Computer

Computer type
PC/Desktop
OS
Windows 7 64 bit - Server 2008 R2 (64bit)
OK, I think I found the location in the registry.

HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders

All of the user folders' locations are listed here. I can now create a modified reg file easily.

Thanks.
 

My Computer My Computer

Computer type
PC/Desktop
OS
Windows 7 64 bit - Server 2008 R2 (64bit)
I should clarify that I know the location of the folders but I do not know where Windows is storing the information that tell you where these folders are.
OK, I think I found the location in the registry.

HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders
Very close. This registry key exists only for backwards compatibility, and changing values under this key will have no effect on the locations of users' folders. Windows defines user folders under the following registry key,
Code:
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders

I'm not fully clear on your intentions, DJ, but I doubt a reg file is fit for the task--it is not a script--and if you change data under either of the mentioned keys, do know that you'll still have to manually move items in C:\Users\User1 to the new location C:\Data\User1.

On any note, if you require assistance with a script or reg file, feel free to post any snippets here for review.
 

My Computer My Computer

Computer type
PC/Desktop
OS
Windows 10, Windows 8.1 Pro, Windows 7 Professional, OS X El Capitan
Thank you very much for this.

I think reg file will work well for me.

I do not need to move any data files. They will always be in C:\Data\*. I simply need to point any new user profiles to folders in this location. This allows me to have all the user files in location without any system or application generated files.

For example, C:\Users\%username%\ folder contains folders for appdata, searches etc. I really don't care for these folders. iTunes etc. create a log of garbage there. Even Microsoft folder can contain a ton of files. They are necessary for running apps but I don't want to worry about backing them up. By moving the important actual content folders, I can keep a clean data folder for backups.

I am aware that reg file will not move files. I don't really need to move files. If it is a new profile, it is not going to have any data files to move anyway. If I am relocating an existing profile, then I can manually move the data files as it will be a one-off relocation.

I will create a batch file that will check for the existence of the destination folders and create them if necessary. It can then merge the reg file. :-)



I should clarify that I know the location of the folders but I do not know where Windows is storing the information that tell you where these folders are.
OK, I think I found the location in the registry.

HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders
Very close. This registry key exists only for backwards compatibility, and changing values under this key will have no effect on the locations of users' folders. Windows defines user folders under the following registry key,
Code:
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders

I'm not fully clear on your intentions, DJ, but I doubt a reg file is fit for the task--it is not a script--and if you change data under either of the mentioned keys, do know that you'll still have to manually move items in C:\Users\User1 to the new location C:\Data\User1.

On any note, if you require assistance with a script or reg file, feel free to post any snippets here for review.
 

My Computer My Computer

Computer type
PC/Desktop
OS
Windows 7 64 bit - Server 2008 R2 (64bit)
Back
Top