Executing Command on Remote Windows System from a Local Windows Command Prompt
GeneralThis forum is for non-technical general discussion which can include both Linux and non-Linux topics. Have fun!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
The above command, as you know, will execute the commands on the example.com server while we still remain on the command prompt of demo.com.
Similar to the above one, I want to do this on a Windows / DOS command prompt. Any ideas?
Actually, I have to execute a SQL query on MS-SQL Server (2008 and later) running on a Remote Windows system and my system has got Windows 7. Instead of taking a Remote Desktop session and then executing the SQL query on that Windows box frequently, I want to automate it. By automating it, I can redirect the output to a text file and save a lot of time / effort. (Writing a .Net script / program would be an overkill for this trivial task.)
if you want to execute command of windows from linux, i don't sure that there is any utility for it except "rpcclient" and "net rpc" commands, but they're restricted to some of the calls.
as you stated here you want to execute the query on MS-SQL server from linux, you can try "FreeTDS" software. it allows to connect MS-Sql server from linux, else you can create perl script to execute your query on Ms-Sql server from linux. Perl is very reach language and can accomplish this task. so you can connect to Ms-Sql DB host, execute queries, and redirect into text file.
if you want to execute command of windows from linux
...
as you stated here you want to execute the query on MS-SQL server from linux,
I think you misunderstood my question / post. I do not wish to let my Linux box talk to a Windows box. I have Windows 7 and want to execute a command (for example a smiple batch script or a SQL command) on a Remote Windows box.
Windows has a well defined remote-execution interface (often used by service techs) as well as "distributed COM" protocols for remote-procedure-calls and so forth. None of which have any particular association with Linux (and no particular need for it). I think you're asking for help in the wrong forum.
Linux does offer supporting drivers and software which can both talk to Windows machines and receive commands from them ... much as, say, Samba implements the remote printing and file networking protocols that are in common use there. But, from what I read in your OP, Linux does not really enter into your scenario at all. Hence, this won't be a particularly fruitful forum in which to post your question.
By all means, start with the copious documentation that Microsoft has published in its TechNet and MSDN sites.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.