Trying to execute netdom.exe from a ruby script or IRB does nothing
- by Joraff
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