Permanently Change Environment Variables in Windows

Viewed 58232

I found a way to change the default home directory of a user but I am having trouble with it.

enter image description here

enter image description here

enter image description here

Doing this will change the home drive to C:

But then when I check the environment variable:

enter image description here

It is still H:, with a system restart the Enviroment variables in windows settings will also return to H:/

I have also tried changing it like this:

enter image description here

Which appears to work but if i open a new cmd it will have reverted back to H:/

Now I am trying to do this so that OpenSSH will recognise C as my home directory instead of H: which is a network drive, forcing OpenSSH not to work unless I cam connected to my university network via VPN.

What can I do to set this permanently and in the eyes of OpenSSH?

7 Answers

I had a similar issue, the HOMEDRIVE variable was set to U: which was a drive we no longer used. This was just for one particular user. I went to that user's profile in AD and clicked the Attribute Editor tab. There was an attribute for HOMEDRIVE which I changed from U: to C: - when the user logged in again, it was set correctly. I also updated the HomeDirectory attribute here.

This issue had been really frustrating me trying to find a solution, but I have found what I think is the definitive answer and posted it at:

https://stackoverflow.com/a/60235759/12903197

You need to run 'net user USERNAME /homedir:PATH' where USERNAME is the name of the user you are trying to change and PATH is the drive letter and full path to the desired home folder, which must already exist.

Related