Rename My documents to username automatically

  • Thread starter Thread starter bj
  • Start date Start date
B

bj

I work for a school and it would be nice to have the My documents
folder on the desktop actually be the username of the person logged in
at that time. They are logging into a windows domain, and using XP
workstations.

I have found that changing the following registry keys will change the
name, but I just don't how to script it into a batch file or vb
script, and have them run at logon.

[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\CLSID\{450D8FBA-AD25-11D0-98A8-0800361B1103}]
@="My Documents Local"

and

[HKEY_USERS\S-1-5-21-1910989853-1314919565-926709054-1433\Software\Microsoft\Windows\CurrentVersion\Explorer\CLSID\{450D8FBA-AD25-11D0-98A8-0800361B1103}]
@="My Documents Local"

Thanks
bj
 
-----Original Message-----
I work for a school and it would be nice to have the My documents
folder on the desktop actually be the username of the person logged in
at that time. They are logging into a windows domain, and using XP
workstations.

I have found that changing the following registry keys will change the
name, but I just don't how to script it into a batch file or vb
script, and have them run at logon.

[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersio
n\Explorer\CLSID\{450D8FBA-AD25-11D0-98A8-0800361B1103}]
@="My Documents Local"

and

[HKEY_USERS\S-1-5-21-1910989853-1314919565-926709054-1433 \Software\Microsoft\Windows\CurrentVersion\Explorer\CLSID\{
450D8FBA-AD25-11D0-98A8-0800361B1103}]
@="My Documents Local"

Thanks
bj
.
I do this daily.
Right click on the My Documents folder, select rename and
rename it.
 
I work for a school and it would be nice to have the My documents
folder on the desktop actually be the username of the person logged in
at that time. They are logging into a windows domain, and using XP
workstations.

I have found a way to do this so I thought it would be nice to share
with everyone. It is a vb script that my version only works in xp but
by adding the correct registry entry it will work for any version.

1. Open notepad
2. copy the folowing text into it (don't forget to fix the word
wrapping).

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' This script will change the name of "My Documents" on the desktop
' to the username of the person logged in.
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Set WshNetwork = WScript.CreateObject("WScript.Network")
Set WshShell = WScript.CreateObject("WScript.Shell")

' Error checking & get user
on error resume next
UserName=WshNetwork.UserName
if err.number <> 0 then
UserName="NOBODY"
end if
err.clear
on error goto 0

' This next line rewrites the (Default) value
' This will need to be changed depending on what version of windows
you have(currently XP)
WshShell.RegWrite "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\CLSID\{450D8FBA-AD25-11D0-98A8-0800361B1103}\",
UserName & "'s Documents"

'Refreshed desktop
WshShell.AppActivate "Program Manager"
WshShell.Sendkeys "{F5}"

'''''' end copy ''''''''''''

3. save the file as "something.vbs" - make sure you put quotes arround
the name
4. done.

Bj

P.S. Please check out my website www.askbj.com I constantly update it
with new tips, tricks & downloads.
 
Back
Top