Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Alright so not sure if this is entirely possible all in one.

Situation: Brand new computer not on the domain, just a local workgroup. Want to change that computers name, join a domain, and put the computer name in a specific workgroup for that domain. This can all be done via the GUI all at once so it should be hypothetically possible via command line right?

I can rename a local computer using this method: CMD > WMIC COMPUTERSYSTEM where "Name='%computername%'" CALL Rename NEWNAME, Password, User

This works however it requires a restart for the changes to happen.

Next I made a batch file that works great to do what I want using NETDOM, however it can't be used until that computer is restarted due to the name change...

SET /P compname=[promptString]
SET /P org=[promptString]

NETDOM JOIN %compname% /Domain:DOMAIN.NET /OU:%org%,DC=DOMAIN,DC=net /UserD:DOMAIN\user /PasswordD:password /Reboot:15 /verbose
PAUSE

So I guess my question is... is there any way to do this in one way without having to restart? If a restart is absolutely required its too much time consumption; the only reason I want to do this VS using the windows GUI is to get it in the OU I want right away without having to pre-stage or go into AD and move the computer.

share|improve this question
    
I read your question; doesn't matter whether it has to be run on a server; it is related to system administration, and so more relevant on serverfault. Don't take it as an offense, but as an indication on where your question belongs to. –  CharlesB Apr 24 '12 at 22:31
add comment

migrated from stackoverflow.com Apr 25 '12 at 12:18

This question came from our site for professional and enthusiast programmers.

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.