Discussion:
using powershell with ssh
(too old to reply)
ghandi
2007-09-26 20:38:35 UTC
Permalink
I'm wanting to run remote powershell commands and scripts over SSH.
Has anyone been able to setup something like winsshd to execute one
line commands or scripts? I am able to do it interactively, but when
I try to run it without a shell it just hangs. Ultimately I would
like to be able to ssh into a Windows server, execute a powershell
command or script, and have it return the appropriate text to my *ix
command line. Anyone have any ideas there?
Thanks for your time.
Brandon Shell
2007-09-26 21:01:23 UTC
Permalink
Something like this will be in powershell v2 but for now n/software has a
remoting client that does exactly what your looking for
Check this out
http://www.nsoftware.com/powershell

You can use psexec to run scripts and return the data as well... that can be
problematic at best.
Post by ghandi
I'm wanting to run remote powershell commands and scripts over SSH.
Has anyone been able to setup something like winsshd to execute one
line commands or scripts? I am able to do it interactively, but when
I try to run it without a shell it just hangs. Ultimately I would
like to be able to ssh into a Windows server, execute a powershell
command or script, and have it return the appropriate text to my *ix
command line. Anyone have any ideas there?
Thanks for your time.
ghandi
2007-09-26 22:19:13 UTC
Permalink
Post by Brandon Shell
Something like this will be in powershell v2 but for now n/software has a
remoting client that does exactly what your looking for
Check this outhttp://www.nsoftware.com/powershell
You can use psexec to run scripts and return the data as well... that can be
problematic at best.
Post by ghandi
I'm wanting to run remote powershell commands and scripts over SSH.
Has anyone been able to setup something like winsshd to execute one
line commands or scripts? I am able to do it interactively, but when
I try to run it without a shell it just hangs. Ultimately I would
like to be able to ssh into a Windows server, execute a powershell
command or script, and have it return the appropriate text to my *ix
command line. Anyone have any ideas there?
Thanks for your time.
Thanks for your suggestions. I tried both options and neither seemed
to work. Powershell remoting did not offer the ability to use SSH,
and the stuff from /n software kept giving me the following error:
AgentServiceWorker - Error starting up listner.. Exception details:
aq: Cannot load PEM key: The certificate could not be found.
I used the x.509 cert that was included and also tried to use my own.
Neither worked.
Has anyone been able to do this?
Thanks for your time.
Marco Shaw
2007-09-27 14:28:20 UTC
Permalink
Post by ghandi
Thanks for your suggestions. I tried both options and neither seemed
to work. Powershell remoting did not offer the ability to use SSH,
aq: Cannot load PEM key: The certificate could not be found.
I used the x.509 cert that was included and also tried to use my own.
Neither worked.
Has anyone been able to do this?
Thanks for your time.
For the /n software remoting, read the instructions. The process to
load a cert seems easy, but the steps must be followed *exactly* to the
letter or the cert doesn't load properly.

Post back after you retried, and I can help with more details. It works
great with PuTTY...

I just haven't played with it for a month or so, so I don't remember the
details exactly.

Marco
--
----------------
PowerGadgets MVP
http://www.powergadgets.com/mvp

Blog:
http://marcoshaw.blogspot.com
ghandi
2007-09-28 00:31:39 UTC
Permalink
Post by Marco Shaw
Post by ghandi
Thanks for your suggestions. I tried both options and neither seemed
to work. Powershell remoting did not offer the ability to use SSH,
aq: Cannot load PEM key: The certificate could not be found.
I used the x.509 cert that was included and also tried to use my own.
Neither worked.
Has anyone been able to do this?
Thanks for your time.
For the /n software remoting, read the instructions. The process to
load a cert seems easy, but the steps must be followed *exactly* to the
letter or the cert doesn't load properly.
Post back after you retried, and I can help with more details. It works
great with PuTTY...
I just haven't played with it for a month or so, so I don't remember the
details exactly.
Marco
--
----------------
PowerGadgets MVPhttp://www.powergadgets.com/mvp
Blog:http://marcoshaw.blogspot.com
Thanks very much for all the help. I got it working after a few.
Karl Mitschke
2007-09-26 21:03:22 UTC
Permalink
Hello ghandi,
Post by ghandi
I'm wanting to run remote powershell commands and scripts over SSH.
Has anyone been able to setup something like winsshd to execute one
line commands or scripts? I am able to do it interactively, but when
I try to run it without a shell it just hangs. Ultimately I would
like to be able to ssh into a Windows server, execute a powershell
command or script, and have it return the appropriate text to my *ix
command line. Anyone have any ideas there?
Thanks for your time.
Take a look at Powershell Remoting

Free, not complete option:
http://www.codeplex.com/powershellremoting

Purchased option:
http://www.nsoftware.com/powershell/remoting/default.aspx

karl
MichielV
2007-09-27 09:39:01 UTC
Permalink
I have not done this in powershell but I would advise to use the bitvise ssh
commandline client sexec.exe (http://www.bitvise.com/tunnelier). This ssh
client writes output to the console and that output can be captured by
powershell.

regards

Michiel
Post by ghandi
I'm wanting to run remote powershell commands and scripts over SSH.
Has anyone been able to setup something like winsshd to execute one
line commands or scripts? I am able to do it interactively, but when
I try to run it without a shell it just hangs. Ultimately I would
like to be able to ssh into a Windows server, execute a powershell
command or script, and have it return the appropriate text to my *ix
command line. Anyone have any ideas there?
Thanks for your time.
Marco Shaw
2007-09-28 11:40:19 UTC
Permalink
Post by MichielV
I have not done this in powershell but I would advise to use the bitvise ssh
commandline client sexec.exe (http://www.bitvise.com/tunnelier). This ssh
client writes output to the console and that output can be captured by
powershell.
But, the output written to the console is probably seen as a string.

The /n software solution passes back true objects:
http://marcoshaw.blogspot.com/2007/06/powershell-remoting-example.html

Marco
--
----------------
PowerGadgets MVP
http://www.powergadgets.com/mvp

Blog:
http://marcoshaw.blogspot.com
ghandi
2007-09-28 21:08:24 UTC
Permalink
Post by Marco Shaw
Post by MichielV
I have not done this in powershell but I would advise to use the bitvise ssh
commandline client sexec.exe (http://www.bitvise.com/tunnelier). This ssh
client writes output to the console and that output can be captured by
powershell.
But, the output written to the console is probably seen as a string.
The /n software solution passes back true objects:http://marcoshaw.blogspot.com/2007/06/powershell-remoting-example.html
Marco
--
----------------
PowerGadgets MVPhttp://www.powergadgets.com/mvp
Blog:http://marcoshaw.blogspot.com
Text is all I really need at this point. I am running some automation
from Linux and just need to get some information from the Windows side
every once in a while. Does or will Powershell Remoting support
openssh's master connection (if you are familiar with the SSH 2
protocol, this just opens a new channel) or sftp?
Thanks again for your time.
Marco Shaw
2007-09-30 23:50:51 UTC
Permalink
Post by ghandi
Text is all I really need at this point. I am running some automation
from Linux and just need to get some information from the Windows side
every once in a while. Does or will Powershell Remoting support
openssh's master connection (if you are familiar with the SSH 2
protocol, this just opens a new channel) or sftp?
Thanks again for your time.
I'll look into that and possibly ask a /n software contact I have as I
don't know the answer...

Marco
--
----------------
PowerGadgets MVP
http://www.powergadgets.com/mvp

Blog:
http://marcoshaw.blogspot.com
Loading...