Rename Computer in Domain 
Author Message
 Rename Computer in Domain

I've seen some code on-line on renaming a computer, but
doing so will break the trust relationship if member of a
domain.

NETDOM has proven to be unreliable in joining domains
when I've previously renamed the computer. (the error
message is "the network address is invalid.") I can add
and remove workstations to the domain all day long, just
can't use the /JOINDOMAIN switch. I am using NT4 domains
no Win2k in mix. Using NETDOM 1.8.

Ideally I would like to programatically reproduce the My
Computer Properties Identification page where you can
change the computer name and domain in one fell swoop.

What is required when you rename a workstation and keep
the domain trust relationship valid? Some posts on just
changing some reg keys don't seem to be enough--does the
SID need to be regenerated?

My requirements:
1. delete the OLD computer name from the domain
2. rename the workstation and keep the current
relationship with domain intact. (this may involve adding
new computer and re-initializing trust relationship.
3. Ideally, new profiles should not be generated for
workstation/user.
4. Only one reboot required

What language would work "best" for me here--and does
anyone have any code snippets to allow this to happen so
the user experience continues unchanged.

Please, any help (APIs to use, code snippets, general
approach, gotchas) is appreciated!



Sun, 26 Sep 2004 22:10:54 GMT  
 Rename Computer in Domain
You positively can not rename a computer in the domain without taking it out
from the domain first. Deleting account from the domain wipes out any
relationships that domain had with computer.  Therefore you need to rejoin
domain after you rename your machine. Netdom serves the purpose well.
The major problem with your request is a single reboot. After you rename
machine, it needs to reboot before joining domain. Otherwise you need to
find  a mechanism to register NetBios name on the network without reboot.
There is a tool "baptize.exe" that renames PC and makes it available on the
network immediately. Download it here:
http://www.univ-st-etienne.fr/pub/systeme/winnt/divers/
There is no code for the program, but it seems to work on NT machines.

My approach to the problem on the other hand would be to write a few lines
of code that can do this hands free:
1. break off domain, delete account.
2. change computer name in the registry.
3. reboot
4. join domain with new name (netdom) and reboot again.

Regards,
--
Gurgen Alaverdian
http://www.gurgensvbstuff.com

Quote:
> I've seen some code on-line on renaming a computer, but
> doing so will break the trust relationship if member of a
> domain.



Mon, 27 Sep 2004 02:02:40 GMT  
 Rename Computer in Domain
Thanks for the info.

What I am finding out is that renaming the computer and
rebooting isn't good for domain trust relationships. Is
there an approach to handle this? How do I "break" the
domain relationship? It seems I have to do this before I
rename computer.

-Sterling

Quote:
>-----Original Message-----
>You positively can not rename a computer in the domain

without taking it out
Quote:
>from the domain first. Deleting account from the domain
wipes out any
>relationships that domain had with computer.  Therefore
you need to rejoin
>domain after you rename your machine. Netdom serves the
purpose well.
>The major problem with your request is a single reboot.
After you rename
>machine, it needs to reboot before joining domain.

Otherwise you need to
Quote:
>find  a mechanism to register NetBios name on the

network without reboot.
Quote:
>There is a tool "baptize.exe" that renames PC and makes
it available on the
>network immediately. Download it here:
>http://www.univ-st-etienne.fr/pub/systeme/winnt/divers/
>There is no code for the program, but it seems to work
on NT machines.

>My approach to the problem on the other hand would be to
write a few lines
>of code that can do this hands free:
>1. break off domain, delete account.
>2. change computer name in the registry.
>3. reboot
>4. join domain with new name (netdom) and reboot again.

>Regards,
>--
>Gurgen Alaverdian
>http://www.gurgensvbstuff.com

in message

>> I've seen some code on-line on renaming a computer, but
>> doing so will break the trust relationship if member
of a
>> domain.

>.



Mon, 27 Sep 2004 22:53:46 GMT  
 Rename Computer in Domain

Quote:
> Thanks for the info.

> What I am finding out is that renaming the computer and
> rebooting isn't good for domain trust relationships. Is
> there an approach to handle this? How do I "break" the
> domain relationship? It seems I have to do this before I
> rename computer.

OK, let me clarify what I said before.
To rename computer that is a member of a domain you need:
1. Break the relationship between computer and domain (make computer
temporary a member of a workgroup)
    This step properly terminates relationships, but lives computer account
in tact on the domain.
2. Optionally delete computer account from the domain (recommended if you do
not want to pollute your domain)
3. Rename computer (reboot)
4. Add renamed computer account to the domain and join it (reboot)

All the above can be done with netdom (v1.7 and up)
As I said this method require 2 reboots before you can logon to the domain.
The mentioned "baptize.exe" utility might reduce it to a single reboot.

Hope this help,
Gurgen.



Tue, 28 Sep 2004 00:57:53 GMT  
 Rename Computer in Domain
Thanks for the info!

What I have found out so far:
RenameComputerInDomain function is a Win32API that works
on Win2k on up---will rename the computer both in the
domain and locally with no fuss-- when it works :-p

Versions previous to Win2k must use NetUserSetInfo,
SetComputerName to accomplish same thing.

Only problem is I want to use VB6 or VB.net and know I
need to "export" these win32api so I can use them in VB---
off to the vb group!

Thanks!!
Sterling

Quote:
>-----Original Message-----

in message

>> Thanks for the info.

>> What I am finding out is that renaming the computer and
>> rebooting isn't good for domain trust relationships. Is
>> there an approach to handle this? How do I "break" the
>> domain relationship? It seems I have to do this before
I
>> rename computer.

>OK, let me clarify what I said before.
>To rename computer that is a member of a domain you need:
>1. Break the relationship between computer and domain
(make computer
>temporary a member of a workgroup)
>    This step properly terminates relationships, but

lives computer account
Quote:
>in tact on the domain.
>2. Optionally delete computer account from the domain

(recommended if you do
Quote:
>not want to pollute your domain)
>3. Rename computer (reboot)
>4. Add renamed computer account to the domain and join
it (reboot)

>All the above can be done with netdom (v1.7 and up)
>As I said this method require 2 reboots before you can

logon to the domain.

- Show quoted text -

Quote:
>The mentioned "baptize.exe" utility might reduce it to a
single reboot.

>Hope this help,
>Gurgen.

>.



Thu, 30 Sep 2004 04:17:09 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. Shuting Down after Renaming Computer ...

2. Rename and change the domain of a print server

3. Renaming Computer

4. Renaming Workstation Computer

5. Renaming computer and workgroup

6. Renaming a computer and workgroup by VBScript.

7. WSH ideas regarding workgroup, computer renaming

8. Enumerate computers in a NT 4.0 domain?

9. Add computer to domain

10. Domain computer belongs to

11. Add computer to domain

12. remove computer from NT Domain

 

 
Powered by phpBB® Forum Software