Joining an Active Directory domain using netdom

Posted by Cheezo on Server Fault See other posts from Server Fault or by Cheezo
Published on 2012-11-08T16:24:19Z Indexed on 2012/11/09 5:05 UTC
Read the original article Hit count: 442

I have a simple script to join an AD domain and rename the computer. When I execute these commands directly on the CLI, it works fine.

When I execute the same via batch file, I get an error saying

The network path was not found

I am running as Administrator with full privileges. I have googled around microsoft forums but my case is unique because it works from the CLI and not from the batch file

netdom join %%computername%% /domain:OPSCODEDEMO.COM /userd:Administrator /passwordd:xxx
netdom renamecomputer %%computername%% /NewName:%hostname% /Force

The environment is Windows 2k8 R2 SP1 running on Ninefold Cloud (Xenserver).

© Server Fault or respective owner

Related posts about Windows

Related posts about batch-file