Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Changing computer name from command prompt (+SMBIOS)

7 views
Skip to first unread message

Oli Restorick

unread,
Oct 14, 2002, 7:23:21 AM10/14/02
to
I thought I'd share a program that I've just written, as I couldn't find
anything else that did the trick.

Use this at your own risk. It was only written this afternoon so, although
it seems stable, the onus is on you to check.

Anyway, the program allows machines running Windows 2000 and above to be
renamed to enable a corporate naming scheme. The program can be run from a
batch file, or from your unattended install.

It is capable of reading serial numbers/asset tags from the SMBIOS and using
these as part of the name. It can also insert the current date into the new
name.

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

For help, use compname /?

Note: the program uses SetComputerNameEx from kernel32.dll. This renames
the physical DNS name of the computer and, implicitely, the NetBIOS name.
This call is not available prior to Windows 2000. Before you ask, I
probably won't be working around this. Other programs I tried (which were
written with NT in mind) didn't rename the DNS name, which isn't much use.

You should beware of using names longer than 15 characters. The NetBIOS
name will be truncated, but the DNS name won't be.

Don't run this on a computer that's a domain member. It was designed to be
run prior to joining the machine to the domain. If you want to join the
machine to the domain afterwards, try netdom.exe.

A reboot is required for the name-change to take effect.

Feedback is welcome, especially if anyone has ideas for new macros.

Cheers

Oli

Andrew Z Carpenter

unread,
Oct 15, 2002, 10:18:35 AM10/15/02
to
Will it allow the setting of a computer name that is purely numerical?

Windows 2000 itself doesn't allow this (unfortunately - try it!).

Andrew

> "Oli Restorick" <use...@willowhayes.co.uk> wrote in message
> news:Ozn18R3cCHA.1704@tkmsftngp10...

Oli Restorick

unread,
Oct 15, 2002, 11:00:04 AM10/15/02
to
I've just tried it, and the answer is no.

My program just calls the Windows 2000 API to set the name. The DLL call
fails when called with a numerical name.

Even if you could set a purely numerical name, you wouldn't be able to do
much with it. Try going to the command prompt and typing:

ping 1337

You get the following:
C:\>ping 1337
Pinging 0.0.5.57 with 32 bytes of data:

Request timed out.
Request timed out.
Request timed out.
Request timed out.

The IP implementation interprets this as an IP address in a different
notation.

Hope this helps

Oli

"Andrew Z Carpenter" <a...@nospamcirencester.ac.uk> wrote in message
news:u51lFWFdCHA.1608@tkmsftngp12...

Andrew Z Carpenter

unread,
Oct 16, 2002, 9:20:34 AM10/16/02
to
> > "Andrew Z Carpenter" <a...@nospamcirencester.ac.uk> wrote in
> > message news:u51lFWFdCHA.1608@tkmsftngp12...
> >
> > Will it allow the setting of a computer name that is purely numerical?
> >
> > Windows 2000 itself doesn't allow this (unfortunately - try it!).
> >
> > Andrew
>
>
> "Oli Restorick" <use...@willowhayes.co.uk> wrote in
> message news:eLZK2tFdCHA.2524@tkmsftngp10...

>
> I've just tried it, and the answer is no.
>
> My program just calls the Windows 2000 API to set the name. The DLL call
> fails when called with a numerical name.
>
> Even if you could set a purely numerical name, you wouldn't be able to do
> much with it. Try going to the command prompt and typing:
>
> ping 1337
>
> You get the following:
> C:\>ping 1337
> Pinging 0.0.5.57 with 32 bytes of data:
>
> Request timed out.
> Request timed out.
> Request timed out.
> Request timed out.
>
> The IP implementation interprets this as an IP address in a different
> notation.
>
> Hope this helps
>
> Oli

Oli,

Thanks for the information. It's pretty much what I expected.

Regards,

Andrew


0 new messages