# Re-Joining computers to the domain after re-image



## sir subaru (Jul 7, 2003)

Hi, I'm having trouble getting our Computers to rename themselves after a successful image. When we were simply using a workgroup there were no probs (as things were much simpler) but now that we've finally moved to a domain the way Windows Server stores computername/SID/whatever information in its database is causing me grief

My original plan was to have Sysprep setup join the domain with a randomly generated name and have My post image setup script and the "netdom renamecomputer" utilitiy to rename the computer/s to their respective names afterwards (e.g. PC1, PC2 etc). 
The theory sounds fine however since the name PC1 is allready in the list of computers on Active Directory. A/D returns an errror saying that the renaming cannot take place. 

Is there a utility that will allow the client to remove the specific computer from Users and computers so to allow the renaming to take place?

The only other way around this that I can think of is to add an extra reboot in the post setup process is
- Sysprep setup joins workgroup instead of domain
- Postimage setup renames computer (reboot)
- Final setup joins domain (reboot)
Tests so far say that will work however I suspect there could be problems regarding passwords needing to be reset if/when the computer is imaged after 30days (if i was reading the search sites correctly) Plus if i'm able to do it by my original plan then I will (the less reboots I have the better)

There must be a way for this to work as I suspect a lot (if not most) businesses/corporates out there to have some sort of naming convention going on for their client workstations.
If anybody can help me out here it'd be much appreciated :sayyes:


----------



## crazijoe (Oct 19, 2004)

What are you using for imaging the computers. (RIS, Ghost, etc.)


----------



## sir subaru (Jul 7, 2003)

Hi, heh sorry I should of mentioned this before. 

We're using Ghost solutions suite (Ghost 8) only we're not always using the console. Much of the imaging is still initiated via a bootdisk

Also just after that first post of mine I found in the Reference Guide that _somehow_ you can program the configuration client to perform computer naming/domain joining and it happens right after ghost finishes imaging but before the pc starts and runs sysprep (I'm assuming here the config client alters sysprep)

So i'll be having a look at that and see if it will do what I want. It should do...hopefully :sayyes:


----------



## crazijoe (Oct 19, 2004)

Have you tried using Ghost Walker.

http://service1.symantec.com/SUPPORT/ghost.nsf/docid/1999050308324125


----------



## sir subaru (Jul 7, 2003)

I believe I did try it when we first got ghost (just with workgroup joining though) but Sysprep seemed to work better, though there's no reason why I shouldn't try again.

Also I had a look at the documentation regarding the Ghost configuration client but found that even if you were experienced in programming in Visual C++ .net, working with dlls and such (which i'm not) symantec still don't guarantee it to work and advise you to use sysprep to join domains. (which probably explains why they barely mention it in the reference guide)


----------



## crazijoe (Oct 19, 2004)

We bought ghost to image computers on our domain but found it less than pleasing to work with because of the problem with the SIDs. We ended up just using the RIS package that comes with Win2K3. It's a lot more difficult to set up but it gave us better results. When I say difficult I mean it took us weeks in a test environment to get it hashed out.

Another note: 
We also found out the ghost images did not keep. They would get corrupt and/or become ussless after a while.


----------



## aprior (Jan 10, 2006)

Why not remove the old computer account from AD before the domain joining/renaming?


----------



## crazijoe (Oct 19, 2004)

aprior said:


> Why not remove the old computer account from AD before the domain joining/renaming?


The problem arises when you add the computers that were ghosted. They will all have the same SID which will not will not work with AD. You have to change the SID on all the computers, which is a task that is less then pleasent.


----------



## aprior (Jan 10, 2006)

crazijoe said:


> The problem arises when you add the computers that were ghosted. They will all have the same SID which will not will not work with AD. You have to change the SID on all the computers, which is a task that is less then pleasent.


SysPrep allows you to change the SID just as easily as to rename the computer.
I assumed that this procedure was already in use by the OP.


----------



## crazijoe (Oct 19, 2004)

aprior said:


> SysPrep allows you to change the SID just as easily as to rename the computer.
> I assumed that this procedure was already in use by the OP.


I assumed that also and figured he could get it to work properly so I suggested using the ghostwalker to change the SIDs.


----------



## aprior (Jan 10, 2006)

I don't think the issue is that the SIDs aren't changing, you can't just rename a computer account in AD to one that already exists unless it has the same SID as the computer account you are renaming to.
It seems like the computers are being added to the domain and then the names are being changed, and since SysPrep should assign a unique random SID to the computer, you can't just rename a computer account that's in the directory to one that already exists, and you can't change an existant computer account to have a new SID without removing it (AFAIK).

Just removing the computer account should to it.


----------



## crazijoe (Oct 19, 2004)

Ahh..Yes, I see where you are coming from. The existing computer account in AD went into the back of my head when it was mentioned. That clearifies a few things.


----------



## aprior (Jan 10, 2006)

Ya, I think the only real relevant question is:


sir subaru said:


> Is there a utility that will allow the client to remove the specific computer from Users and computers so to allow the renaming to take place?


Which unfortunately I don't have an answer for other than doing it manually using the Active Directory Users and Computers MMC snap-in. It shouldn't be too hard.
@OP: How many computers do you set up a day?

[edit: A Google search should turn up lots of scripts for removing the computer account.]


----------



## sir subaru (Jul 7, 2003)

aprior said:


> I don't think the issue is that the SIDs aren't changing, you can't just rename a computer account in AD to one that already exists unless it has the same SID as the computer account you are renaming to.
> It seems like the computers are being added to the domain and then the names are being changed, and since SysPrep should assign a unique random SID to the computer, you can't just rename a computer account that's in the directory to one that already exists, and you can't change an existant computer account to have a new SID without removing it (AFAIK).
> 
> Just removing the computer account should to it.


Thats the idea, 
The reason why i'm after a script is because we've just started teaching "intro to Windows Domain networking" (we previously taught Novell) and thought it be a good idea to have the PCs "domain ready" to save the student having to rejoin the thing all the time (since its a student lab, things often go haywire and require a reimage) :sayyes:


----------



## aprior (Jan 10, 2006)

sir subaru said:


> Thats the idea,
> The reason why i'm after a script is because we've just started teaching "intro to Windows Domain networking" (we previously taught Novell) and thought it be a good idea to have the PCs "domain ready" to save the student having to rejoin the thing all the time (since its a student lab, things often go haywire and require a reimage) :sayyes:


Ah... I see.
Did you happen to find anything useful? I ended up looking through some of the Googled ones and couldn't really find anything that didn't require you to manually enter the name of the computer, so wasn't very un-attended.

Let us know if you do find one that works though, I'm sure other people would like to know.... or hopefully someone else can find something that works.


----------



## sir subaru (Jul 7, 2003)

I did find this
I havn't had a chance to tinker and try it out yet but i'll certainly give it a try
I know which computer needs deleting its just a matter of specifiying it to the script. And of course making "it" a variable

Edit: Update!
I emailed the above link to the author of the program "wsname" yesterday 
_wsname being the program I was originally using to rename computers_ and he's gotten back to me with an updated version

His program originally had the means to rename computers on a domain but only when the name didn't allready exist. His newly updated version though gets around that problem.

If it works the guy is a godsend :1angel: :sayyes:


----------



## sir subaru (Jul 7, 2003)

Just an update here

The guy who makes the program wsname has updated it to version 4.75d which not only is it able to rename domain computers if that name allready exists (which in my case it almost always will) it will delete the PC from active directory

Yay! :grin:


----------



## aprior (Jan 10, 2006)

sir subaru said:


> Just an update here
> 
> The guy who makes the program wsname has updated it to version 4.75d which not only is it able to rename domain computers if that name allready exists (which in my case it almost always will) it will delete the PC from active directory
> 
> Yay! :grin:


Thanks for the update, that's good to know!


----------

