Sign in with
Sign up | Sign in
Your question

Change Computer Name- via command line or registry

Last response: in Windows XP
Share
Anonymous
June 15, 2004 5:31:42 PM

Archived from groups: microsoft.public.windowsxp.configuration_manage (More info?)

Hi All,

I've been looking around for a while, to get a smooth way to change
computer name remotely. I know that there are utils that does that, but
I'm really looking for a simple command line with parameters, if exists?
1.) Using registry
(HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\ComputerName\ComputerName\ComputerName)
works after reboot, with some side effects (If you check in control
Panel->System it will keep show you old name, although system uses new
name). Any explanations how to fix that?

2.) I'd really like to hear from MS expert wheter any of command line
utils can change computer name (I believe it does). I've been playing
around with netsh, net.

Best Regards!

--
Noerr De Dykul
Anonymous
June 15, 2004 11:21:37 PM

Archived from groups: microsoft.public.windowsxp.configuration_manage (More info?)

Noerr,

See if this helps, from Torgeir, MVP Scripting:

<quote>

Platform SDK: Windows Management Instrumentation
Rename Method in Class Win32_ComputerSystem
http://msdn.microsoft.com/library/en-us/wmisdk/wmi/rena...

Technet Script Center > Computer Management > Rename a Computer and Computer Account
http://www.microsoft.com/technet/scriptcenter/compmgmt/...


'Changing computer name for WNT/W2k/WXP with script:

sNewName = "put new name here"

Set oShell = CreateObject ("WSCript.shell")

sCCS = "HKLM\SYSTEM\CurrentControlSet\"
sTcpipParamsRegPath = sCCS & "Services\Tcpip\Parameters\"
sCompNameRegPath = sCCS & "Control\ComputerName\"

With oShell
.RegDelete sTcpipParamsRegPath & "Hostname"
.RegDelete sTcpipParamsRegPath & "NV Hostname"

.RegWrite sCompNameRegPath & "ComputerName\ComputerName", sNewName
.RegWrite sCompNameRegPath & "ActiveComputerName\ComputerName", sNewName
.RegWrite sTcpipParamsRegPath & "Hostname", sNewName
.RegWrite sTcpipParamsRegPath & "NV Hostname", sNewName
End With ' oShell

MsgBox "Computer name changed, please reboot your computer"

</quote>

--
Ramesh - Microsoft MVP
Windows XP Shell/User
http://www.mvps.org/sramesh2k

AumHa VSOP: http://www.aumha.org

"Noerr" <dedykul@hotmail.com> wrote in message news:o pr9mvm4jpo2ud6d@news.siol.net...
Hi All,

I've been looking around for a while, to get a smooth way to change
computer name remotely. I know that there are utils that does that, but
I'm really looking for a simple command line with parameters, if exists?
1.) Using registry
(HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\ComputerName\ComputerName\ComputerName)
works after reboot, with some side effects (If you check in control
Panel->System it will keep show you old name, although system uses new
name). Any explanations how to fix that?

2.) I'd really like to hear from MS expert wheter any of command line
utils can change computer name (I believe it does). I've been playing
around with netsh, net.

Best Regards!

--
Noerr De Dykul
June 2, 2010 1:19:35 PM

Having just wasted 3 days trying to work out why lsass.exe was crashing after I renamed a machine by this method...

BEWARE! Max hostname length is 15 chars. If you modify your registry with a longer hostname, you'll get stuck in an infinite reboot loop. :fou: 

NoseyNick
September 22, 2011 10:52:03 PM

Hi this script does the name chage ie MY Computer or Computer to your netbios name. Works on all flavours of Windows Except Windows 2008 R2 Enterprise

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\CLSID\{20D04FE0-3AEA-1069-A2D8-08002B30309D}]
@="My Computer"
"InfoTip"=hex(2):40,00,25,00,53,00,79,00,73,00,74,00,65,00,6d,00,52,00,6f,00,\
6f,00,74,00,25,00,5c,00,73,00,79,00,73,00,74,00,65,00,6d,00,33,00,32,00,5c,\
00,53,00,48,00,45,00,4c,00,4c,00,33,00,32,00,2e,00,64,00,6c,00,6c,00,2c,00,\
2d,00,32,00,32,00,39,00,31,00,33,00,00,00
"IntroText"=hex(2):40,00,25,00,53,00,79,00,73,00,74,00,65,00,6d,00,52,00,6f,00,\
6f,00,74,00,25,00,5c,00,73,00,79,00,73,00,74,00,65,00,6d,00,33,00,32,00,5c,\
00,53,00,48,00,45,00,4c,00,4c,00,33,00,32,00,2e,00,64,00,6c,00,6c,00,2c,00,\
2d,00,33,00,31,00,37,00,35,00,31,00,00,00
"LocalizedString"=hex(2):25,00,43,00,6f,00,6d,00,70,00,75,00,74,00,65,00,72,00,\
6e,00,61,00,6d,00,65,00,25,00,00,00
!