You can use a VBScript to change the computer name. Put this in a file called Rename_Computer.vbs and run it:
'===================
strComputerName = InputBox("Enter a new machine name for this computer:", "Rename Computer")
Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=imper
Set colComputers = objWMIService.ExecQuery ("Select Name from Win32_ComputerSystem")
For Each objComputer in colComputers
intErrorCode = objComputer.Rename(strComp
If intErrorCode <> 0 Then
MsgBox "Error renaming computer. Error # " & intErrorCode
Else
Set objOutputFile = objFSO.CreateTextFile(strR
objOutputFile.Close
Set objOutputFile = Nothing
MsgBox "Computer renamed. It will now reboot."
objShell.Run "rundll32 shell32.dll,SHExitWindowsE
End If
Next
'================
Regards,
Rob.
Main Topics
Browse All Topics





by: r-kPosted on 2007-07-12 at 22:15:23ID: 19478370
Not sure what you mean by "OS has tanked" and why it would be necessary to change computer name in that case, but the computer name is stored in the Registry, in this key:
Set\Contro l\Computer Name\Compu terName\
p.com/regs _edits/com putername. vbs
p.com/xp_t weaks.htm
HKLM\SYSTEM\CurrentControl
You can download a VB script to change it from the command line from Kelly's Korner:
http://www.kellys-korner-x
This is tweak # 109 on this page:
http://www.kellys-korner-x