Send command from batch shell to shell - shell

My structure looks like this:
I have one Windows PC which is running 24/7 in my cellar and I have one Windows PC in my office (at home). Both are in the same network and I have admin privileges on both.
How can I set up a batch-file on my office PC which can send a command to the other PC through the command line? I should be able to turn off and reconnect my office PC without running every time in my cellar.

The SHUTDOWN command can remotely turn off other computers on your network but I am not sure what you mean by reconnect.

Have you taken a look at the tools described here ? If you are not on the latest version (or rather server version) of Windows, then you might have to download the tools mentioned here.
http://network-shutdown.com/remotely-shutdown-computers-on-network

Related

Possible ways to run windows batch command from Unix

I am trying to run a windows batch command from CentOS 6. I would like to know the best way to achieve this. I explored PsExec and WinExe utilities in unix to connect to windows machine and run the required commands.
I am trying this on a windows VM which is within company network, hence kindly highlight any specific network issues that I may have to check for the setup to run.
Any pointers would help.
Have you seen the examples from the PowerShell for Linux GitHub pages, as the working examples seem to cover this off nicely?
https://github.com/PowerShell/PowerShell/tree/master/demos/SSHRemoting
It will require SSH installed onto your Windows server, but otherwise seems to tick all of your boxes.

Accessing OpenCL GPU from windows 7 through ssh

I have computers where I want to run OpenCL apps remotely using a command line tool, something like the problem described here: http://devgurus.amd.com/thread/160690, but I am with nVIDIA hardware.
I have several computers with W7 and XP where I did install cygwin and OpenSSH. The XP ones, work OK with OpenCL, but not the W7 ones.
Is there any flag, trick, setting that can help be to overcome this problem of Windows? Or in SSHD server?
Found the solution myself:
The easyer way to overcome this problem is to use PSEXEC tool from sysinternals.
However, there are some problems with this tool too.
In order to work properly it is needed:
An account in the remote computer with proper rights (Admin preferable)
Launch PSEXEC in interactive mode (-i), otherwise the access to the GPU is not available.
Have a local user connected, or a local user was the last one to connect. If a RDP session is running or the last user connecting has been trough RDP it will likely not work too. Since the GPU will already be disabled.
I am open to accept anyone else's better answer.
Thank you!

Is it possible to write a script to run an application on Windows VM from your mac?

I am using a RDC Connection from my mac to connect to an application (on windows box) in client network. Is that possible to write a script which does the following:
Open ur RDC. (i am using CoRD for this where my VM credentials are saved in .rdp files.
Login to VM with valid credentials from your .rdp file.
Open your app on that VM (for ex: IE explorer)
Following code in my shell script will connect me to my VM.(First two steps are working)
open rdp://[username[:password]#]hostname
How should I automate third step?
Is there any other way than shell script?
If you install Jenkins on your Mac, then install the Jenkins slave agent on the Windows machine, you can remotely run any command you like on the Windows box via the Jenkins web UI, and get back the results as well. In that scenario there's no need to use RDC at all.
For some more background, see: https://wiki.jenkins-ci.org/display/JENKINS/Distributed+builds
This might be a simplistic answer, but AutoHotKey is something that will automate your 3rd step. Its free and pretty easy to script. You can have this in your start up routine for your VM, so when you log in, you can have this kick off your job.
I have used it before for testing some Java Swing components on Windows and its been pretty handy (Windows was running on a Virtualbox VM on my Mac).

Executing .bat file remotely from Linux box

I'm trying to execute a .bat file on a windows box remotely from a Linux box by connecting via ssh, obtaining windows command prompt and then executing the batch file.
When I connect to the windows machine I can see that the process is running but the graphical interface is not being invoked.
Regards
Rahul
Probably, you need to install x server on windows? Consider for xming as one option. I am assuming that you have installed ssh-server on windows system.
NOTE: You need to login on the windows box (once, after windows login), start the x server on windows & then onwards you should be able to ssh to the system & start the GUI application.
Another possible issue:
The ssh-server binary should be executed by the user, after logging in once after the windows system boot. Then ssh to that windows box, export DISPLAY=:0 & run GUI app.
NOTE: I have not tested any of the above 2 solution, but these are what I think as possible solutions.
One more solution:
Create a dedicated TCP based server (on windows) client (on linux) model & send commands over that channel. A dirty way & would be able to give limited functionality, but it is tested to be working.

executing command on a Windows Machine from a UNIX/LINUX Machine

is it possible to execute a command (ex: launching a .bat file located on the remote machine) on a Windows Remote Machine, using a UNIX or Linux Machine ?
Is there something like a scp/ssh mechanism or at least a way to connect to a Windows Machine passing through the network ?
Thanks for your help.
By default, recent Windows versions only support the Remote Desktop protocol. As far as I know, client versions only allow a single user, while server versions with installed Terminal Services allow for multiple simultaneous users.
Windows Server versions also support the Telnet protocol, but the server is disabled by default - it may not even be installed. Therefore you will have to enable it manually. Do you really want to use Telnet of all things, though? Just the security concerns are enough to make it mostly useless.
There is also a version of OpenSSH for Windows, that uses the Cygwin DLL. I have not tried it, but using an SSH implementation from the Unix world does have its appeal (and probably a few disadvantages). See also this.
EDIT:
Recent Windows versions also support the Windows Remote Management system, which allows you to launch an interactive session throuh a bit of trickery.
You may want to try Vandyke VShell.

Resources