How to change computername

  • Thread starter Thread starter Matte
  • Start date Start date
M

Matte

Hello.

As the topic says how if its possible to change the computername in a batch
file?

Any info or help is greatly appreciate.
 
Matte said:
Hello.

As the topic says how if its possible to change the computername
in a batch file?

Any info or help is greatly appreciate.
Hi,

Changing the computer name with the free command line utility
compname.exe is an option:

http://www.willowhayes.co.uk/download/compname.exe

Subject: Setting computer name at command prompt from SMBIOS (asset
tag) info
Date: Thu, 17 Oct 2002 23:16:32 +0100
From: "Oli Restorick" <[email protected]>

<quote>
I'm reposting this, because looking at the log files for my web site,
it is clear that quite a few people tried to download the file but,
due to problems with my web host, the download didn't happen.

That should now be fixed. Meanwhile, I've made quite a few updates to
the program.

Compname.exe is a utility to generate a computer name to your
specifications, optionally pulling in data including asset tag/serial
number from the chassis, motherboard and system, System UUID/GUID, mac
address, IP address octets, date, and a random element.

The program should run fine on all Windows platforms since Windows 95,
including Windows NT. If available (i.e 2000, XP, .net) the program
will call SetComputerNameExA from kernel32.dll. If this function is
not available, it calls SetComputerNameA from the same DLL. This
ensures that, for 2000 and above, the DNS host name and the NetBIOS
name both get set properly.

Download the utility and type "compname.exe /?" to get the syntax.
It's pretty easy.

For example,

"compname.exe /c jupiter" sets the computer name to jupiter
"compname.exe /c PC-?k-?l" will use the IP address. If the IP address
is 192.168.1.100, the name will be "PC-1-100"
"compname.exe /c pc-?s" sets the machine to "pc-abcdef" where abcdef
is the SMBIOS asset tag/serial number.
"compname.exe /c pc-?9" generates a name including nine random
characters.

The program can also be used for reading any of these fields (by using
the /d[isplay] option), or for piping these numbers into other
applications.

"compname.exe /s" will give you a summary of the SMBIOS, IP and MAC
information.

Any comments, bug reports or suggestions for improvements are very
welcome.

</quote>
 
Thanks, Torgeir. :-)

I'd just like to add that this command should not be run on a machine that
is a domain member (unless rejoining the domain by script is an option),
since domain membership gets broken with the rename. The netdom.exe command
is great for scripting a domain join.

Cheers

Oli


Torgeir Bakken (MVP) said:
Matte said:
Hello.

As the topic says how if its possible to change the computername
in a batch file?

Any info or help is greatly appreciate.
Hi,

Changing the computer name with the free command line utility
compname.exe is an option:

http://www.willowhayes.co.uk/download/compname.exe

Subject: Setting computer name at command prompt from SMBIOS (asset
tag) info
Date: Thu, 17 Oct 2002 23:16:32 +0100
From: "Oli Restorick" <[email protected]>

<quote>
I'm reposting this, because looking at the log files for my web site,
it is clear that quite a few people tried to download the file but,
due to problems with my web host, the download didn't happen.

That should now be fixed. Meanwhile, I've made quite a few updates to
the program.

Compname.exe is a utility to generate a computer name to your
specifications, optionally pulling in data including asset tag/serial
number from the chassis, motherboard and system, System UUID/GUID, mac
address, IP address octets, date, and a random element.

The program should run fine on all Windows platforms since Windows 95,
including Windows NT. If available (i.e 2000, XP, .net) the program
will call SetComputerNameExA from kernel32.dll. If this function is
not available, it calls SetComputerNameA from the same DLL. This
ensures that, for 2000 and above, the DNS host name and the NetBIOS
name both get set properly.

Download the utility and type "compname.exe /?" to get the syntax.
It's pretty easy.

For example,

"compname.exe /c jupiter" sets the computer name to jupiter
"compname.exe /c PC-?k-?l" will use the IP address. If the IP address
is 192.168.1.100, the name will be "PC-1-100"
"compname.exe /c pc-?s" sets the machine to "pc-abcdef" where abcdef
is the SMBIOS asset tag/serial number.
"compname.exe /c pc-?9" generates a name including nine random
characters.

The program can also be used for reading any of these fields (by using
the /d[isplay] option), or for piping these numbers into other
applications.

"compname.exe /s" will give you a summary of the SMBIOS, IP and MAC
information.

Any comments, bug reports or suggestions for improvements are very
welcome.

</quote>





--
torgeir, Microsoft MVP Scripting and WMI, Porsgrunn Norway
Administration scripting examples and an ONLINE version of
the 1328 page Scripting Guide:
http://www.microsoft.com/technet/scriptcenter/default.mspx
 
Back
Top