Page 1 of 1 1
Topic Options
#124344 - 2004-08-03 05:14 PM change location "my documents" dont work
expodium Offline
Fresh Scripter

Registered: 2004-07-14
Posts: 35
hi,

i try to change the my document folder from the c drive to a f drive (f:\my documents) but its seems that he dont change the location.

my source( yeah i known but use the function for other purpose also ):


Change_Favorites("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders","My Pictures","f:\my documents\My Pictures","REG_SZ")
Change_Favorites("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders","Personal","f:\my documents","REG_SZ")
Change_Favorites("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders","My Pictures","f:\my documents\My Pictures","REG_EXPAND_SZ")
Change_Favorites("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders","Personal","f:\my documents","REG_EXPAND_SZ")

Function Change_Favorites($regKey, $subKey, $regValue, $regType)
WriteValue($regkey, $subkey, $regValue, $regType)
EndFunction

is there a other way to do?

i try also

WriteValue("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders","personal","f:\my documents","REG_SZ")

but when i go see to the property's of "my documents" its still in the old directory (c:\documents and settings\etc....)

who known how to do this?

many many thanks in advance

expodium


Top
#124345 - 2004-08-04 08:59 AM Re: change location "my documents" dont work
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11631
Loc: CA
Hmmm.... odd I just tried some code on a Non-Networked Windows XP w/SP1 and manually it does not seem to work as you say. If I redirect it via the GUI it works, but if I redirect it via the Registry as the KB articles say it does not change even if I reboot and set the HKLM key.

Getting late here so going to bed, perhaps someone else can assist you with this, as I won't be back on line maybe for another day.

Code:
Break On
Dim $SO
$SO=SetOption('Explicit','On')
$SO=SetOption('NoVarsInStrings','On')

Dim $UpdateMD,$ReadMD,$UpdateAD,$NewFolder
$NewFolder='D:\My Documents'
$UpdateMD=WriteValue('HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders','Personal',$NewFolder,REG_SZ)
$ReadMD=ReadValue('HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders','Personal')
$UpdateMD=WriteValue('HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders','My Music',$ReadMD+'\My Music',REG_SZ)
$UpdateMD=WriteValue('HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders','My Video',$ReadMD+'\My Video',REG_SZ)
$UpdateMD=WriteValue('HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders','My Pictures',$ReadMD+'\My Pictures',REG_SZ)
$UpdateAD=WriteValue('HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\DocFolderPaths',@USERID,$NewFolder,REG_SZ)



Configuration of the My Documents Folder
http://support.microsoft.com/?id=221837



User Data and Settings Management
http://www.microsoft.com/technet/prodtechnol/windowsserver2003/technologies/management/user01.mspx

Top
#124346 - 2004-08-04 10:34 AM Re: change location "my documents" dont work
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
doc, you don't set the user shell folders at all, when the last link you gave said:
Quote:

Using Logon Scripts to Redirect Folders
Although using Group Policy to redirect users folders is the recommended method, there are alternate ways to achieve similar results. You can use logon scripts to set the values of the User Shell Folders key in the registry, which will give you basic functionality similar to Folder Redirection.

Alternatively, you could use Windows NT 4.0 system policies to set the appropriate values. However if you choose to do this, you loose the advantages of using Group Policy to set folder paths, such as automatic moving of files when the path changes, and the registry settings will persist.





dunno what the first link suggested but know it's kinda irrelevant:
Quote:


The information in this article applies to:
Microsoft Windows 2000 Server
Microsoft Windows 2000 Advanced Server
Microsoft Windows 2000 Professional
Microsoft Windows 2000 Datacenter Server



_________________________
!

download KiXnet

Top
#124347 - 2004-08-04 10:36 AM Re: change location "my documents" dont work
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
expodium, have you created the destination directory before the change?
_________________________
!

download KiXnet

Top
#124348 - 2004-08-05 07:01 AM Re: change location "my documents" dont work
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11631
Loc: CA
Don't think it is irrelavant as it does have to do with Folder Redirection and 2000/XP/2003 all support it.

Anyways... I did pre-create the folder structure and rebooted even, but still does not take affect.

Just thought it was odd behavior that so many sites say it works including Microsoft, but when I tried doing it via Registry edits it did not work.

Top
#124349 - 2004-08-05 09:27 AM Re: change location "my documents" dont work
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
doc, like I said, you didn't touch the users shell folders keys, when the second document specifically descriped that as the way for NT5.1+
_________________________
!

download KiXnet

Top
#124350 - 2004-08-05 11:56 AM Re: change location "my documents" dont work
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11631
Loc: CA
You're correct Lonkero, I was modifying those keys (but did not post that code) but I was also modifying all the other keys at the same time which apparently was causing some issue preventing it from working. Trimming down the code to only modify the User Shell Folders keys now appears to work fine.

You MUST restart though for the change to take affect



Code:
Break On

Dim $SO
$SO=SetOption('Explicit','On')
$SO=SetOption('NoVarsInStrings','On')

Dim $UpdateMD,$ReadMD,$Key,$NewFolder
$NewFolder = 'D:\My Documents'
$Key = 'HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders'
$UpdateMD = WriteValue($Key,'Personal',$NewFolder,REG_EXPAND_SZ)
$ReadMD = ReadValue($Key,'Personal')
$UpdateMD = WriteValue($Key,'My Pictures',$ReadMD+'\My Pictures',REG_EXPAND_SZ)
$UpdateMD = WriteValue($Key,'My Music',$ReadMD+'\My Music',REG_EXPAND_SZ)
$UpdateMD = WriteValue($Key,'My Videos',$ReadMD+'\My Videos',REG_EXPAND_SZ)


Top
#124351 - 2004-08-05 02:46 PM Re: change location "my documents" dont work
Kdyer Offline
KiX Supporter
*****

Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
However, if memory serves, you can do the same thing in GPO and is on the fly.

Kent
_________________________
Utilize these resources:
UDFs (Full List)
KiXtart FAQ & How to's

Top
#124352 - 2004-08-05 02:51 PM Re: change location "my documents" dont work
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
yep, possible ways GPO, NTpolicy, reg-hack.
for AD and no need to support older than w2k, they recommend GPO.
otherwise it's script.
_________________________
!

download KiXnet

Top
#124353 - 2004-08-05 02:53 PM Re: change location "my documents" dont work
Kdyer Offline
KiX Supporter
*****

Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
True.. Just the restart is kinda kludgy (IMHO). I know it would be the only way to get the reg to work.

Kent
_________________________
Utilize these resources:
UDFs (Full List)
KiXtart FAQ & How to's

Top
Page 1 of 1 1


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 640 anonymous users online.
Newest Members
ManuvdWielNL, Sir_Barrington, batdk82, StuTheCoder, M_Moore
17887 Registered Users

Generated in 0.061 seconds in which 0.024 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org