Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


My Documents Location

 
Logged in as: Guest
arrSession:exec spGetSession 2,2,1695
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> My Documents Location
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 My Documents Location - 12/13/2004 1:50:28 AM   
  Tr0jan

 

Posts: 5
Score: 0
Joined: 11/24/2004
From:
Status: offline
Is there a way (exept registry) to change the location of my documents automatically using VB script? Ive tried changing it under the current user in the registry, but to no avail, it doesn't apply the changes, even after a restart.

I can read the location of the my documents using WMI but dont know how to write to it. (if possible)

Thanks in advance

TR
 
 
Post #: 1
 
 Re: My Documents Location - 2/23/2005 2:58:13 AM   
  hbomb

 

Posts: 14
Score: 0
Joined: 10/20/2004
From: USA
Status: offline
yes you can. send me an email at rhinton@chestnut.org and I will send you the script.

(in reply to Tr0jan)
 
 
Post #: 2
 
 Re: My Documents Location - 2/23/2005 3:40:11 AM   
  Bushmen

 

Posts: 122
Score: 0
Joined: 2/4/2005
From:
Status: offline
would like to see code too..

any possibility to post it on this forum?

bushmen

(in reply to Tr0jan)
 
 
Post #: 3
 
 Re: My Documents Location - 2/23/2005 3:49:43 AM   
  tnoonan

 

Posts: 364
Score: 0
Joined: 12/14/2004
From:
Status: offline
http://www.pbdr.com/ostips/cmydocs.htm

http://support.microsoft.com/kb/q242557/

(in reply to Tr0jan)
 
 
Post #: 4
 
 Re: My Documents Location - 2/23/2005 4:05:11 AM   
  esnmb

 

Posts: 448
Score: 0
Joined: 1/11/2005
From: USA
Status: offline
Set objShell = Wscript.CreateObject("Wscript.Shell")

Set objNetwork = CreateObject("Wscript.Network")
objUser = objNetwork.UserName

objShell.RegWrite "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders\Personal", "x:\NEW PATH\" & objUser & "\My Documents", "REG_EXPAND_SZ"

(in reply to Tr0jan)
 
 
Post #: 5
 
 Re: My Documents Location - 2/23/2005 1:53:32 PM   
  token

 

Posts: 1917
Score: 0
Joined: 1/14/2005
From:
Status: offline
I don't think there are other ways of changing the my documents location except in the registry. I don't understand why you would want to programatically change its location though. Will you be changing it on a regular basis ? Do you intend to use the scripts to modify the default location for domain users ? If so, you might want to consider using GPO. Above all else, it does work when the registry entry is modified; however, you might have to change a user's entry other than the one you currently log on with if you decide to do it manually through the registry.

(in reply to Tr0jan)
 
 
Post #: 6
 
 Re: My Documents Location - 2/23/2005 2:47:17 PM   
  tnoonan

 

Posts: 364
Score: 0
Joined: 12/14/2004
From:
Status: offline
Agree if forcing domain wide just use GPO. Only reason I could think of changing mydocuments location is if you were not using roaming profiles and wanted to change it to save on a share folder on network for backup.

(in reply to Tr0jan)
 
 
Post #: 7
 
 Re: My Documents Location - 2/23/2005 3:02:06 PM   
  token

 

Posts: 1917
Score: 0
Joined: 1/14/2005
From:
Status: offline
Yup, totally. The confusion I had is this: " Is there a way (exept registry) to change the location of my documents automatically using VB script?". I use scripts to perform tasks that I need to have on a regular basis. I'm puzzled by the fact that I would want to change the location of my documents folder "regularly". But that's just me

(in reply to Tr0jan)
 
 
Post #: 8
 
 Re: My Documents Location - 2/24/2005 12:43:32 AM   
  esnmb

 

Posts: 448
Score: 0
Joined: 1/11/2005
From: USA
Status: offline
I had to work on a project where my manager for some reason didn't want to use GPO's, so I did some research and all I could find for changing the location is my modifying the registry.

(in reply to Tr0jan)
 
 
Post #: 9
 
 Re: My Documents Location - 2/24/2005 2:12:28 AM   
  Bushmen

 

Posts: 122
Score: 0
Joined: 2/4/2005
From:
Status: offline
so he can not use the registry, and not gpo..

am i right in saying, we're back to square one!

bushmen

(in reply to Tr0jan)
 
 
Post #: 10
 
 Re: My Documents Location - 2/24/2005 2:33:34 AM   
  esnmb

 

Posts: 448
Score: 0
Joined: 1/11/2005
From: USA
Status: offline
Seems that way. :\

(in reply to Tr0jan)
 
 
Post #: 11
 
 Re: My Documents Location - 2/24/2005 2:55:46 AM   
  token

 

Posts: 1917
Score: 0
Joined: 1/14/2005
From:
Status: offline
I believe the registry is the only way, even GPO itself does the same thing.

(in reply to Tr0jan)
 
 
Post #: 12
 
 Re: My Documents Location - 2/25/2005 7:46:15 PM   
  kracksmith

 

Posts: 198
Score: 0
Joined: 2/24/2005
From:
Status: offline
Just curious, why change the location with a script or even in the registry?

You can change the location by just right clicking your my document, click properties and select move.

(in reply to Tr0jan)
 
 
Post #: 13
 
 Re: My Documents Location - 2/25/2005 9:49:13 PM   
  Snipah


Posts: 1343
Score: 6
Joined: 11/1/2004
From: Netherlands
Status: offline

      


(in reply to Tr0jan)
 
 
Post #: 14
 
 Re: My Documents Location - 2/26/2005 7:49:12 AM   
  token

 

Posts: 1917
Score: 0
Joined: 1/14/2005
From:
Status: offline
quote:
Originally posted by kracksmith

Just curious, why change the location with a script or even in the registry?

You can change the location by just right clicking your my document, click properties and select move.



heh.. good point. However, I don't use that 'folder' anyway, I didn't even realize you can do that :)

(in reply to Tr0jan)
 
 
Post #: 15
 
 RE: Re: My Documents Location - 7/13/2006 1:28:17 AM   
  mrbandit

 

Posts: 1
Score: 0
Joined: 7/13/2006
Status: offline
I'm also looking for a script solution that changes the 'My Documents' target and here's why...

#1 We have GPO's that lock everything down on the desktop.
#2 When you do a manual change it asks to move the data from the users current location to the new location in an uncontrolled method that I can't report on.
#3 and most importantly I want control the process to cut down on the number of helpdesk calls.

I'm not really a VB person, but I am a programmer.  I'm using a programming lang. called Winbatch to do the copying, verifying, reporting and reg calls, but I quickly found out that the My Documents target is an OLE object that won't refresh with a simple reg change and I don't really want to kill the explorer process.  I looked around and found this on Hey Scripting Guy....
.............................................
Const MY_DOCUMENTS = &H5&
Set objShell = CreateObject("Shell.Application")
Set objFolder = objShell.Namespace(MY_DOCUMENTS)
Set objFolderItem = objFolder.Self
Wscript.Echo objFolderItem.Path
..............................................

It does display the current My Documents target, but not being a VB person I can't figure out how to push the new location back to objFolderItem.Path.  Can anyone help me with this?

Thanks in Advance!

(in reply to token)
 
 
Post #: 16
 
 RE: My Documents Location - 7/13/2006 12:10:19 PM   
  dm_4ever


Posts: 2674
Score: 46
Joined: 6/29/2006
From: Orange County, California
Status: offline
when changing "my documents" location in the registry there are two keys with a "personal" string that can be modified. for some reason sometimes changing one and not the other works, in some cases i've found i need to change it in both.

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

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

(in reply to Tr0jan)
 
 
Post #: 17
 
 RE: My Documents Location - 7/13/2006 11:56:16 PM   
  mbouchard


Posts: 1916
Score: 16
Joined: 5/15/2003
From: USA
Status: offline
Why not change it via GPO?  At the least, why not import the reg key using GPO?

_____________________________

Mike

For useful Scripting links see the Read Me First stickey!

Always remember Search is your friend.

(in reply to dm_4ever)
 
 
Post #: 18
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> WSH & Client Side VBScript >> My Documents Location Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts