Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

script to redirect my documents folder 1

Status
Not open for further replies.

markstangroom

Technical User
Apr 25, 2001
96
GB
i have a system set up where the clients have roaming profiles and the default location for the "My Documents" folder is set to their home directory on the server.

the problem i am having is that whenever there is a glitch on the network or server, XP creates a "My Documents" folder in the profile and changes the default location back to the C:\ drive. The users don't notice and start saving documents to this folder instead.

i know this can be done through the registry but i was wondering if there is a script i could run at logon to make sure when the profile loads it always sets "My Documents" to the H:\ drive?

thanks

Mark
 
This is a Windows question, nothing to do with Samba, but anyway:

In Windows 2000, the path to the My Documents folder is stored in the registry, in the string value "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders\Personal". It's normally set to the value "%USERPROFILE%\My Documents", but you can change that to whatever you want. There are two ways of scripting this:

(1) Export the key to a .reg file, edit the file as appropriate, and include in your script the command:[tt] regedit /s filename.reg[/tt]
(2) Use the command:[tt] reg update "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell\Folders\Personal=H:\\"[/tt]
 
Correction:

In the last line in my last post, "Shell\Folders" should of course read "Shell Folders".
 
Thanks TonyGroves

reg update didn't work on my XP systems but I got reg add to, and it works a treat and will save a lot of hastle in the future.

Mark
 
OK, I see how this works, but shouldn't there be a simpler way? Can't I set %USERPROFILE% to H:\ then all the values in "User Shell Folders" would be referenced to that?
 
Hi I tried the command below, it said operation completed successfully but it didn't change anything in the registry. I am using W2K server.

Reg ADD "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders\" /v Personal /t REG_EXPAND_SZ /d %H:\My Documents%
 
wonderslug:

If you wanted to redirect the whole profile, you could do that.


hiepster:

I'm not familiar with those switches, /v and /t and /d.
According to my system (WNT/W2K) the syntax is:[tt]
REG ADD RegistryPath=Value [DataType] [\\Machine]
[/tt]
 
hiepster, you may try this:
Reg ADD "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders\" /v Personal /t REG_EXPAND_SZ /d "H:\My Documents" /f

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
OK, I added these to the login script for a user and it made My Documents into a Synchronized folder and it won't let me change it back to unsynchronized. Any ideas? I just want it to be a network drive working on-line all the time.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top