Registry location for home folder
Posted on 2011-10-05
I really can't seem to understand this.
I'm trying to write a vbscript to search the registry for a specified user's home folder, but there is no absolutely consistent key I can find. I have seen the two following:
HKEY_USERS\<sid>\Volatile Environment\HOMESHARE and
HKEY_USERS\<sid>\Software\Microsoft\WIndows\CurrentVersion\Explorer\User Shell Folders\Personal
The problem is, neither one of these match (100% of the time) the variable located in the user's Active Directory "Profile" tab.
In every case, we have "\\server\users$\username" as the share mapped to the user's "H" drive. But on any given server (we have over 200 to support) the above keys can vary. For example: On a test server we have here, the HOMESHARE key is set to "\\server\users$", while the "Personal" key is what I am looking for. On another server, the HOMESHARE is what I want, and the "Personal" key has the share, but with "My Documents" appended to the end.
So how in the hell can I programatically find a user's share (at \\server\users$\username) while I'm not logged in as that user?