Sometimes it comes very handy to do tasks via command prompt, especially when you are dealing with many PCs at one time. When I setup PCs, I give them proper names, instead of usual DESKTOP-SERIAL format or similar.

For this task, we’ll use WMI (Windows Management Instrumentation). It is relatively simple:

wmic computersystem where caption="%COMPUTERNAME%" rename "NEW-PC-NAME"
shutdown /r /f /t 2

This grabs the variable COMPUTERNAME from the OS, then plugs it into WMI query. Then for changes to take effect, we are rebooting the PC via shutdown command.

This beats having to deal with GUI, especially with new Windows 10 Settings page, which I hate.