Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Change computer name 1

Status
Not open for further replies.

Wings

Programmer
Feb 14, 2002
247
US
Hi,
Hi, I'm working on a project where different computers will be placed in and pulled out of a network. The problem is, I need to be able to configurre the names of those systems through either a script or code.

Does anyone know how I can change the name of my computer through code? Any window calls, ect.. Also in the same scheme of things, is it possible to change the name of other computers on the LAN?

Thanks
 
I am not sure, but I do know that when I change the name of my Win98 machine, re-boot is required. That may not be something you want to happen.

my 2 cents....
onrdbandit
 
this is an interesting piece of information and if it is what I think it is it would open up a full can of worms.

read up on the TRegistry object
***********************

TRegistry::RegistryConnect
Establishes a connection to a registry on another computer.

bool __fastcall RegistryConnect(const AnsiString UNCName);

Description

Call RegistryConnect to establish a connection to a registry on another computer running Windows 95 or Windows NT. UNCName is the name of the remote computer, and must take the following form:

\\computername

where computername is the name of the remote computer. If UNCName is NULL, the local machine name is used.

Note: Before calling RegistryConnect, an application must set the RootKey property for its registry object to HKEY_USERS or HKEY_LOCAL_MACHINE.

If connection is successful, RegistryConnect sets the RootKey property to the root key of the remote computer and returns true. If unsuccessful, RegistryConnect returns false, and RootKey remains unchanged.

never used it before

tomcruz.net
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top