Trying to execute netdom.exe from a ruby script or IRB does nothing

Posted by Joraff on Stack Overflow See other posts from Stack Overflow or by Joraff
Published on 2010-06-02T23:18:49Z Indexed on 2010/06/02 23:24 UTC
Read the original article Hit count: 303

Filed under:
|
|

I'm trying to write a script that will rename a computer and join it to a domain, and was planning to call on netdom.exe to do the dirty work. However, trying to run this utility in the script (same results in irb) does absolutely nothing. No output, no execution. I tried with backticks and with the system() method. System() returns false for everything but system("netdom") (which returns true). Backticks never return anything but an empty string.

I have verified that netdom runs and works in the environment the script will be running in, and I'm calling other command-line utilities earlier in the script that work (w32tm, getmac, ping).

Here's the exact line that gets executed:

`netdom renamecomputer %COMPUTERNAME% /NewName:#{newname} /force`

FYI, This is windows 7 x64

© Stack Overflow or respective owner

Related posts about ruby

Related posts about windows-7