Question : How to programmatically remove and then add a computer to a domain

I have dozens of VM Windows 2003 machines who's SID gets changed when moving them around, or when resetting them to specific snapshots.

When the SID changes, they no longer can log on to the domain.

I like to have a script or a method that would programmatically remove and then add a computer to a domain, or some method to reset the domain programmatically to accept the new SID.

How can I fix this programmatically?

Answer : How to programmatically remove and then add a computer to a domain

you can use netdom
netdom remove %computername% /d:DOMAIN /UD:USER /PD:PASSWORD
netdom join      %computername%  /d:DOMAIN /UD:USER /PD:PASSWORD

http://technet2.microsoft.com/windowsserver/en/library/9f921edc-87f5-460e-89ee-9ca56ec1d0961033.mspx?mfr=true

Bye Gastone Canali
Random Solutions  
 
programming4us programming4us