1

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).

1
  • Totally off-topic for a programming-related Q&A site - this belongs on Serverfault.com where sysadmins hang out ...
    – marc_s
    Nov 8, 2012 at 16:59

1 Answer 1

5

I suspect your double percent signs are the culprit.

You can see how it's executing in your batch file by adding an echo on immediately before the first netdom and running the batch file from an elevated command prompt. I expect that you're going to see something like:

netdom join %THE_COMPUTER_NAME% /domain:OPSCODEDEMO.COM /userd:Administrator /passwordd:xxx

How you're getting it to work at all w/ the double percent signs, even just running those commands on the CLI "by hand", is baffling me.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .