Question

How can I change the omputer name at command prompt in XP

Asked by: cpsimon

I have a DEll Optiplex with Windows XP and a Pentium 4 with 256 RAM.  The OS has tanked.  Is there some way at the command prompt to change the computer name? I do not know what directory it is kept

This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.

Subscribe now for full access to Experts Exchange and get

Instant Access to this Solution

  • Plus...
  • 30 Day FREE access, no risk, no obligation
  • Collaborate with the world's top tech experts
  • Unlimited access to our exclusive solution database
  • Never be left without tech help again

Subscribe Now

Asked On
2007-07-12 at 21:33:47ID22693749
Tags

computer

,

change

,

name

,

command

Topics

Microsoft Operating Systems

,

Windows XP Operating System

,

Microsoft Windows Operating Systems

Participating Experts
6
Points
500
Comments
26

Trusted by hundreds of thousands everyday for fast, accurate and reliable tech support.

  • "The time we save is the biggest benefit of Experts Exchange to Warner Bros. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange." Mike Kapnisakis, Warner Bros.
  • "Our team likes having a resource that is more secure than just using Google and most experts using this service really know their stuff. It's nice to look here first versus using Google." Dayna Sellner, Lockheed Martin
  • "Anytime that I've been stumped with a problem, 9 out of 10 times Experts Exchange has either the accepted solution or an open discussion of the potential solution to the problem." Kenny Red, eBay Inc.

See what Experts Exchange can do for you.

Got a question?

We've got the answer.

Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.

Screenshot of Experts Exchange Knowledgebase

Need individual assistance?

Our experts are ready to help.

If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.

Screenshot of Experts Exchange Knowledgebase

Want to learn from the best?

Read articles from industry experts.

Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.

Screenshot of an Article

Working on a long term project?

Store your work and research.

Save solutions to your questions, answers you’ve discovered through searching plus helpful articles in your personal knowledgebase for easy future access.

Screenshot of Experts Exchange Knowledgebase

Access the answers to your technology questions today.

Subscribe Now

30-day free trial. Register in 60 seconds.

What Makes Experts Exchange Unique?

Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Trusted by the world's most respected brands.

image of each brand's logo

Faithfully serving IT professionals since 1996.

Experts Exchange Logo

Try it out and discover for yourself.

Subscribe Now

30-day free trial. Register in 60 seconds.

Related Solutions

  1. Dell Optiplex SX280
    We have installed Winodw XP SP2, Office XP SP3 on a Dell Optiplex SX280, Can anyone help with the following. We have various templates that contain the company logo, the logo is not present on opening and existing or new documnet until you select print preview. Once the page...
  2. Dell Optiplex gx520
    Previous IT locked down these computers with a password in the Bios. How do I reset the Bios so that I can reinstall XP and make these machines usable? Dell Optiplex gx520 Thanks
  3. Help w/ booting to CD - Dell Optiplex
    I have a Dell Optiplex w/ Win 2K that I want to upgrade to XP. Normally, I change boot sequence to read CD first then have it boot from XP CD, delete old partition, re-partition and install. This PC will not boot from CD. The option appears to 'hit any key' to boot from CD...
  4. Strange error msg : LOB Problem : Dell Optiplex
    Just come across a very strange error msg. Cannot seem to find anything related after doing some googling. After we log into the network (AD) we are prompted with an error : - Missing Fields - Dell optiplex 760 OS : XP service pack 3. Missing the Following unknown Fiel...

Free Tech Articles

  1. WARNING: 5 Reasons why you should NEVER fix a computer for free.
    It is in our nature to love the puzzle. We are obsessed. The lot of us. We love puzzles. We love the challenge. We thrive on finding the answer. We hate disarray. It bothers us deep in our soul. W...
  2. SCCM OSD Basic troubleshooting
    SCCM 2007 OSD is a fantastic way to deploy operating systems, however, like most things SCCM issues can sometimes be difficult to resolve due to the sheer volume of logs to sift through and the dispe...
  3. Migrate Small Business Server 2003 to Exchange 2010 and Windows 2008 R2
    This guide is intended to provide step by step instructions on how to migrate from Small Business Server 2003 to Windows 2008 R2 with Exchange 2010. For this migration to work you will need the fo...
  4. Create a Win7 Gadget
    This article shows you how to create a simple "Gadget" -- a sort of mini-application supported by Windows 7 and Vista. Gadgets can be dropped anywhere on the desktop to provide instant information, ...
  5. Outlook continually prompting for username and password
    There have been a lot of questions recently regarding Outlook prompting for a username and password whilst using Exchange 2007. There are a few reasons why this would happen and I will try to cover t...
  6. Backup Exchange 2010 Information Store using Windows Backup
    There seems to be quite a lot of confusion around the ability to backup Exchange 2010 using the built in Windows Backup feature. This stems from the omission of this feature prior to Exchange 2007 s...

Cloud Class Webinars

  1. Avoiding Bugs in Microsoft Access
    Alison Balter takes and in-depth look at avoiding bugs in Access. In this webinar you will learn about using the immediate window to debug your applications, invoking the debugger, using breakpoints to troubleshoot, stepping through code, setting the next statement to execute, ...
  2. Top 10 Best New Features in Visio 2010
    Scott Helmers gives live demonstrations of the top 10 new features in Visio 2010. This webinar will teach you how to create compelling diagrams by adding shapes to the page with a single click, linking the shapes in a diagram to data in Excel (or SQL Server, or SharePoint), ...
  3. IT Consultant Business Secrets Revealed
    Michael Munger, Experts Exchange tech pro and IT consultant, pulls back the curtain on his very successful businesses and answers question on every IT consultant and business owner should know about. He shares secrets on what he did to solve the 5 most common problems in IT, ...
  4. Disaster Recovery and Business Continuity
    Quest CTO, Mike Billon, gives an overview of the steps involved in building a dunamic disaster recovery plan. Through case studies and an examination of software/hardware tooles for monitoring and testing, you'll gain a better understandin of where you are, where you want ...
  5. Organize Your Visio Diagrams with Containers and Lists
    Scott Helmers uses cross functional flowcharts, wireframe diagrams, data graphic legends and seating charts to teach you: how to ustilize all three new structured diagram components in Visio 2010, the best practices for organizeing shapes in previous version of Visio, how to organize ...
  6. How to Us Objects, Properties, Events and Methods in Microsoft Access
    Alison Dalter gives an in-depbth look at objects, properties, events and methods in Microsoft Access. In this webinar you will learn about using the object browser, referring to objects, working with properties and methods, working with object variables, understanding the ...

Join the Community

Give a Little. Get a Lot.

Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.

Join the Community

Answers

 

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:

 HKLM\SYSTEM\CurrentControlSet\Control\ComputerName\ComputerName\

You can download a VB script to change it from the command line from Kelly's Korner:

 http://www.kellys-korner-xp.com/regs_edits/computername.vbs

This is tweak # 109 on this page:

 http://www.kellys-korner-xp.com/xp_tweaks.htm

 

by: RobSampsonPosted on 2007-07-13 at 00:18:39ID: 19478720

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=impersonate}!\\" & "." & "\root\cimv2")
Set colComputers = objWMIService.ExecQuery ("Select Name from Win32_ComputerSystem")
For Each objComputer in colComputers
      intErrorCode = objComputer.Rename(strComputerName)
      If intErrorCode <> 0 Then
            MsgBox "Error renaming computer. Error # " & intErrorCode
      Else
            Set objOutputFile = objFSO.CreateTextFile(strRenameFlag, True)
            objOutputFile.Close
            Set objOutputFile = Nothing
            MsgBox "Computer renamed. It will now reboot."
            objShell.Run "rundll32 shell32.dll,SHExitWindowsEx 2", 1, False
      End If
Next
'================

Regards,

Rob.

 

by: RobSampsonPosted on 2007-07-13 at 00:24:51ID: 19478737

If you need to do it from DOS, outside of Windows, you *may* be able to use NewSID from Microsoft, but I'm not sure that will run outside windows:
http://www.microsoft.com/technet/sysinternals/Security/NewSid.mspx

Or, if you have NETDOM.exe from Windows 2003 support tools, you could try:
netdom renamecomputer currentname /newname:new_computername

but that probably only works on a domain, and from within Windows....

Regards,

Rob.

 

by: and235100Posted on 2007-07-13 at 00:49:56ID: 19478790

As RobSampson says - as long as you had the windows support tools installed, and CD to the correct directory, you can use netdom:
http://support.microsoft.com/kb/298593

 

by: pegasysPosted on 2007-07-13 at 01:28:23ID: 19478916

net name /ADD MyComputerName

should work

 

by: KCTSPosted on 2007-07-13 at 02:46:13ID: 19479239

I think we might be overlooking the real problem here.
Why do you think it is necessary to change the computer name, what problem are you trying to solve.

 

by: cpsimonPosted on 2007-07-14 at 09:23:06ID: 19487330

Thank you all for your input. I have tried unsuccessfully some of the solutions.

To pegasys
I have tried the net name /ADD MyComputerName with no success.  I have tried every possible combination because when I use this syntax, it displays a help screen. Also I receive service not available message.  This solutions seems to simplest to do if I can get to work.  

to kcts
I have a utility which will allow me get in and do a restore before it crashed.  It needs to have a more generic computer name for it to work.  It is the registry and system files which are corrupted.

Robsampson
I will try the netdom.exe which I should have it it comes with Windows server 2003.

 

by: KCTSPosted on 2007-07-14 at 09:54:36ID: 19487421

If the registry and system files are corrupt then restore you system state from a backup.

What utility are you using to try and recover your system - someone here may hve used it and can offer a solution, or if you explain what the problem is in detail another solution might be forthcoming

 

by: cpsimonPosted on 2007-07-14 at 14:12:02ID: 19488181

There is no backup.  I need the XP to boot so the person does not have reinstall all their programs.   It is not the utility. I just need to change the computer name and the fix will follow.

 

by: cpsimonPosted on 2007-07-18 at 11:11:51ID: 19515941

I am still trying to fix this.   It should not be this difficult to change the name within the command prompt. I tried running the vbs program from RobSampson at the command line. It was looking for a program to run it.  I have a utilty which will run and do a restore if I can change the computer name.

 

by: RobSampsonPosted on 2007-07-18 at 17:26:51ID: 19518340

If you cannot get into Windows, you will not be able to run the VBS script, because it uses the Win32 namespace, which is not loaded in DOS.
I am surprised that a recovery tool cares about a DOS computer name though.....
anyway, have a look here:
http://www.fpschultze.de/smartfaq+faq.faqid+65.htm

although it seems you may need some sort of Network Boot Disk (try Bart's boot disk: http://www.nu2.nu/bootdisk/network/) to load the Network protocols before being able to run that batch file....

Regards,

Rob.

 

by: cpsimonPosted on 2007-07-18 at 19:25:09ID: 19518757

For  RobSampson,
Actually I am using Barts boot disk which boots into a windows XP environment. I tried to run  the vbs program at the run and command prompt. Neither works.  Perhaps I am not in the correct directory to run it.   I was in the Windows directory and the root directory of the c drive.

 

by: RobSampsonPosted on 2007-07-18 at 19:30:55ID: 19518813

But wouldn't you then be changing the HostName of just that environment, and not your corrupt installation?

To run the script, you need an executable in that environment called either wscript.exe or cscript.exe, and it must have WSH 5.6 installed, which it may not.  If it does, however, find that executable, then run
wscript c:\script.vbs    or    cscript c:\script.vbs

When you load into this XP environment, are you able to load the registry hives of the corrupt system, to actually change *that* installation's host name?  I might be confusing the situation here though....

Regards,

Rob.

 

by: cpsimonPosted on 2007-07-19 at 06:33:19ID: 19521680

Hi,
Thank you for your prompt response.  I cannot load the registry. When I run regedit, the Bart PE's registry appears not the one for that particular computer.  I do not thinks that those script exe files are on the computer. I will see if they are on the Bart's Pe CD.  I am not sure if sp2 is even on the computer I am trying to fix.  I did not do the original configuration.  It is my understanding to run any VB script that sp2 has to be loaded.  

 

by: marco_peereboomPosted on 2007-07-19 at 14:19:11ID: 19526256

After renaming the PC it will probably still 'tank'.
There is no single way of booting it? I.e. without networkcables attached...
What does it say during boot anyway? NTLDR is failing? Something else?

 

by: RobSampsonPosted on 2007-07-19 at 17:15:30ID: 19527625

Hmmm, I agree with Marco_peereboom.
If you cannot load the registry, or even onto that disk in any way, you won't be able to change anything. You could only restore, somehow......
We probably need to concentrate on why it's "tanked", and how to recover it.

Regards,

Rob.

 

by: cpsimonPosted on 2007-07-19 at 20:48:31ID: 19528596

Hi,
I said I could not load the registry using Bart PE. I never can load the registry using that CD. My guess with my other utility that it will work. I will be able to restore the registry to an earlier date.
The utility may also be able to restore network connections as well.  It has worked great in the past.  

 

by: RobSampsonPosted on 2007-07-19 at 22:08:16ID: 19528847

We don't seem to be getting much information out of you about what the error is when you try to boot, or how it came to this in the first place.  If you cannot provide more information about the cause of the problem, it becomes very difficult for us to assist you.  You have not defined what "the OS has tanked" means, so we have no way of providing you a possible solution in the right direction.

Also, you have not stated what "your utlity" is, or how it recovers the OS (based on the computer name?).

Anyway, I think if you are able to use something like ERD Commander or NTFS4DOS to read the files from the hard drive, your *cleanest* solution is probably to recover all of your data files to some other media, then re-install everything, and put your data back.

Rob.

 

by: r-kPosted on 2007-07-19 at 22:15:36ID: 19528871

Seems like what you need is an offline Registry editor, see e.g.

 http://windowsxp.mvps.org/peboot.htm

and then change the value as mentioned in my very first post at the top.

 

by: cpsimonPosted on 2007-07-20 at 06:30:35ID: 19530757

Hi,
"Tanked" means, when I boot up, the computer hangs. It goes to the Windows screen and then goes blank and stays there.  When I go to safe mode, it only does the first screen and stops.  I do not know what happened to  this computer.  It is not mine.  It was working one minute and then it was not according to my friend.   I do not believe it is a virus because the protection was up to date.  I am just guessing that it is a corrupt registry.
I already can get to the hard drive with Bart PE.  I know I have the option of getting the data and reinstalling it.  I would like to have fixed it without starting fresh.  I cannot believe there is no easy way of changing the computer name, but maybe in the Windows environment it is that way.  I do not like loose ends.
I do really appreciate all your help.  
I will try one more time to change the name.   ERD Commander would work as well as what I have.  I do have a license for it.

 

by: RobSampsonPosted on 2007-07-21 at 18:16:43ID: 19541218

I had exactly the same problem.....twice.....with a Dell laptop that I had.  It would start to boot as normal, finish the "Windows XP Logo" bit, and then stay a slightly whiter black screen (like a "lit up" black screen), but would go no further.  Same thing in Safe Mode, it would scroll through the drivers, then just stop.

Any amount of hard drive testing tools that I had reported that the Hard Drive was perfectly fine.  I tried ChkDsk, that didn't change it.  I tried a Repair of Windows, that didn't change it.

In the end, I *had* to boot to DOS with NTFS support and USB device support, copy all of my files to an external USB hard drive, and then format and re-install absolutely everything.  Then, once that was done, I ran hard drives checks again, and everything came up good.

The problem was, it did the same thing again about a week later.  And, while I could see all of the files on the NTFS file system, I was not able to load any of the registry hives that I could see, so I assumed the Registy became corrupt.  Now that I think of it, this *may* have been due to possible faulty RAM.

Anyway, in short, I ended up getting another laptop.

Regards,

Rob.

 

by: cpsimonPosted on 2007-07-22 at 10:28:06ID: 19543227

Hi,
Thanks for sharing your experience.  I have had several Dells do the same thing on several  sites.   I was able to fix them sometimes formatting and reinstalling XP, sometimes doing what I am trying to do now.  Like you I ran a chkdsk \r and the hard drive was fine.  
 I personally have a Toshiba now just a year old which I love.

 

by: RobSampsonPosted on 2007-07-22 at 14:28:10ID: 19543823

I forgot to mention that the second time this happened, because the DOS NTFS copying was painfully slow, I actually re-installed Windows to the same hard drive, in a different folder, just to get into Windows to copy the files, then I formatted......

Regards,

Rob.

 

by: cpsimonPosted on 2007-07-22 at 19:10:58ID: 19544593

I will try that if all else fails.
Thanks.

 

by: r-kPosted on 2007-07-22 at 22:44:08ID: 19545269

Any luck with the offline Registry editor?

 

by: cpsimonPosted on 2007-07-31 at 21:37:04ID: 19606259

I have not had any luck fixing this.  I was trying to avoid reinstalling XP because all the programs will be lost.  It is hard to believe there is no utility to change the name.   One cannot even get ERD Commander in an emergency version.  Apparently, Microsoft has bought it.  
I want to thank you all for trying to help.  

20120131-EE-VQP-002

3 Ways to Join

30-Day Free Trial

The Experts

98% positive feedback on 31,087 answers since March 2000. angeliii is a Microsoft Most Valuable Professional for his work with MS SQL Server & Develoment.

He has also proven his knowledge of Visual Basic Programming, PHP Scripting and Oracle Databases.

The Experts

97% positive feedback on 10,752 answers since July 2000. lrmoore has more than 18 years experience in the networking industry.

The six-time Mircosoft MVPs specialties include firewalls, virtual private networking, and network management.

Testimonials

"...and excellent source for support... Kind of like having your very own IT dept." Electriciansnet

Testimonials

"I was apprehensive at signing up at first. However... it has already made my life as an IT administrator much easier." JaCrews

Testimonials

"WOW! You guys have great, active, and knowledgeable people on here." moore50

Business Clients

Business Clients

In the Press

"If you’ve got a question... Experts Exchange can supply an answer.”

In the Press

"...an invaluable aid for both IT professionals and those who require tech support."

In the Press

"where IT professionals provide quick answers on just about any topic"

Business Account Plans

Loading Advertisement...