My employer has an Active Directory group policy which sets my Windows 7 laptop HOMEDRIVE to "M:" (a mapped network drive) and my HOMEPATH to "\". Since I have read-only permissions for the root of that shared drive, I cannot create files or directories in my windows home directory. My attempts to work with the IT department have been unsuccessful.
Is there a way for me to globally change these envars at boot or login time? I need for all applications to use alternate values (such as "C:" and "\Users\myname"). I have some installed utilities (like gvim and others) that store preference files in the user's home directory.
IMPORTANT: Changing these envars under "System Properties > Environment Variables" does not work. I have tried setting these as both User and System Variables (including a reboot). TypingSET HOME
in a DOS window clearly shows that my settings are ignored. Also, using "Start in" in a Windows shortcut will also not solve this, as I need things like Explorer context menu items (like "Edit with Vim") to operate correctly.
I do have admin rights on this company laptop, but I am not a Win7 guru. Back in the day, a boot script would have solved this in a minute. Is it even possible today? Thanks.
Best Answer
Below are some hacks I've developed. They are not elegant, but may be functional in your corporate environment.
HOMEDRIVE Only
It seems that many applications only use HOMEDRIVE / HOMEPATH. In that case, you can create a startup script that remaps the base drive letter to your local user path via the UNC drive admin path:
HOMEDRIVE Local Default
If you do not need to access "Server" by name at all, you can cause the group policy setting to fail and fall back to your local machine. The easiest way to do this is to add an entry to C:\Windows\System32\drivers\etc\hosts like:
After rebooting, you should see something like:
HOMEDRIVE/SHARE with Hybrid Local/Remote UNC Paths
If you want access to "Server" by name for some UNC paths, but override others with local paths, I have developed the following abomination. Note: direct server connections to "Server" will still resolve to your local machine. I recommend this solution only if "Server" is only a file server:
Modify C:\Windows\System32\drivers\etc\hosts to redirect "Server" to your local machine:
Add the following Multi-String registry value to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa\MSV1_0 to allow credentials to be passed to the local UNC path:
Create a dummy directory that will serve as the root of Server:
For each UNC path you want to direct to the real Server:
For each UNC share you want to define locally (such as Users):
Reboot
For the example, this would allow the following UNC paths to be resolved:
This path resolution should occur prior to drive mappings. As long as the UNC paths associated with the mappings are valid (be they local or remote), drive letters should behave as expected.
For example, in my setup the following variables are forced by the domain:
But due to my mappings, the result is: