0

I know, in .NET, I can get the current computer name with Environment.MachineName. When using Win+R ms-settings:about or something equivalent to change the computer name, how can I get the designated computer name that will be used after restart?

Bolpat
  • 436
  • 2
  • 12
  • I would guess it's stored in the registry, but I would also guess that where in the registry is liable to be version dependent (i.e. any update to windows would possibly change it). Why do you need this information, there may be a better (and supported) way to do what you want. – Neil Oct 17 '18 at 15:46
  • I don't see how this question is about programming. It seems like it's about Windows OS to me. – itsme86 Oct 17 '18 at 15:47
  • How is https://stackoverflow.com/questions/662282/how-do-i-get-the-local-machine-name-in-c then a question is about programming? – Bolpat Oct 17 '18 at 15:57
  • I have to ask. Why? – Reinstate Monica Cellio Oct 17 '18 at 16:09
  • In our corporation, all computer names have to follow some pattern. Because none of the solutions to change the computer name worked, on a wrong pattern, the program prompts the users to change the machine name themselves, opening the About page. I want to check the pattern of the designated name again. – Bolpat Oct 17 '18 at 16:21
  • 1
    I would have personally locked them out of changing the name and written an application that allows them to change it, but also enforces a naming convention. But, either way see below for the info you need. – Reinstate Monica Cellio Oct 17 '18 at 16:22

1 Answers1

1

You can find the future value of the MachineName property at the following registry key...

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\ComputerName\ComputerName
Reinstate Monica Cellio
  • 24,939
  • 6
  • 47
  • 65