You are not logged in.
Hi everyone
I am trying to call a module (for example python or vbs) on a Windows client ( Microsoft Windows [Version 6.1.7601] with Win32-OpenSSH ) from a Linux Server over ssh.
The module is very simple only containing a print command (for example "Hello World")
This is what I got so far:
A)
ssh CONNECT-STRING(-i, domain, username, host) cmd.exe /c python.exe test.py
ssh CONNECT-STRING(-i, domain, username, host) cmd.exe /c cscript test.vbs
...
-> no print output returned
B)
ssh CONNECT-STRING(-i, domain, username, host) python.exe test.py
ssh CONNECT-STRING(-i, domain, username, host) cscript test.vbs
-> print output returned
Unfortunately i need to use the implementation A) because our job-server script executor is defined this way (using cmd.exe /c).
Maybe somebody could give me a explanation why the first implementation does not return the print output.
Is there any kind of way in order to return the output?
Please excuse my english.
Thank you very much for your help.
Cheers jb
Offline
Possibly your remote session is not picking up the system PATH
Try giving the full path to CMD.exe e.g. C:\Windows\System32\cmd.exe
Offline
Hi,
I tried it with the full path and it didnt work either.
In the meantime I did find an acceptable workaround that I can use in our Job-Server by type to the invokation string of the job:
python.exe ${scriptfile} && type {templogfile}
By using an unique templogfile which used in the job and typed then after the script ends.
Unfortunately I still dont know exactly why my initial implementation did not work.
Neverthelesse thank you very much for your input.
Cheers
Offline
Maybe a 32/64 bit thing?
http://stackoverflow.com/questions/3697 … as-cmd-exe
Offline
We are using Windows 7 (32 bit). Reason is we have some applications that are still requiring 32 bit.
Offline
I was able to do some further tests:
ssh CONNECT-STRING(-i, domain, username, host) cmd.exe /c ipconfig
-> no output
ssh CONNECT-STRING(-i, domain, username, host) cmd.exe /c systeminfo
-> no output
ssh CONNECT-STRING(-i, domain, username, host) cmd.exe /c driverquery
-> no output
ssh CONNECT-STRING(-i, domain, username, host) cmd.exe /c driverquery
-> no output
ssh CONNECT-STRING(-i, domain, username, host) cmd.exe /c tasklist
-> no output
ssh CONNECT-STRING(-i, domain, username, host) cmd.exe /c date
-> working
ssh CONNECT-STRING(-i, domain, username, host) cmd.exe /c vol
-> working
Offline
..and
ssh CONNECT-STRING(-i, domain, username, host) cmd.exe ipconfig or
ssh CONNECT-STRING(-i, domain, username, host) cmd.exe /k ipconfig
returns the following error message (german):
Für diesen Befehl ist nicht genügend Speicher verfügbar
Translated:
Not enough storage is available to process this command
I think that resolving this problem could solve my cmd /c problem too.
Offline
I think your latest error is a red herring.
From the commands you mentioned, the common factor would appear to be that running built-in commands (date, vol) works, whereas binaries doesn't (would need more information to understand why that might be).
You could maybe try using this, to use a built-in to start the binary:
cmd /c start /b "" ipconfig
The empty set of double quotes is not a typo.
You could also try redirecting STDERR to STDOUT (in case your connection method is only capturing STDOUT and thus masking an error which could point you toward the problem.) So something like this:
cmd /c ipconfig 2>&1
Or
cmd /c start /b "" ipconfig 2>&1
It might need some escaping to work correctly.
Last edited by bluesxman (16 Feb 2017 13:26)
cmd | *sh | ruby | chef
Offline