开发者

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

开发者 https://www.devze.com 2023-01-02 15:17 出处:网络
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

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, T开发者_如何学JAVAhis is windows 7 x64


may be you should replace %COMPUTERNAME% with an actual computer name?

0

精彩评论

暂无评论...
验证码 换一张
取 消