WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

ADSI
plus

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

Rename Computer in AD


Question:

Hi, I want to create a script to change the name of a local computer and in ActiveDirectory. I'm logged in like a user but I know the password of the admin locally and on the AD.Can somebody help me??

Answer:

You can rename an object in Active Directory with the ADSI extender's dsMoveObj function by specifying the same path in both the first and second parameter, and a new computer name in the form "cn=newname" as the third parameter.

You can then use the ComputerNameSet WB function to change the local computer name, if you are using WB version 2006b or later. You will need to restart the computer to have the changes take effect.

If you have an early version of WB you can use IntControl(76) to perform the local rename but I am not sure if it handles all changes correctly. If not, there is a workaround in the tech. data base. It can be found by searching on "rename computer".


Article ID:   W16807
File Created: 2007:07:03:14:26:22
Last Updated: 2007:07:03:14:26:22