How to end s Powershell script when run from cygwin

I have a Powershell.ps script that does some basic things in a windows machine. I am invoking this script using ssh-ing to a Windows machine. On a Windows computer, cygwin Open-SSh is installed.

Problem: The script is running, but does not return to the SSH session. How do I get a powershell script to end and return control back to an SSH session?

+3
source share
3 answers

, , cygwin sshd powershell citrix - linux.

: http://epeleg.blogspot.com/2010/06/solution-to-powershell-never-exists.html

powershell :


%SystemRoot%\system32\WindowsPowerShell\v1.0\powershell.exe -Noninteractive -Command "& { "your powershell script and arguments here" }"<NUL
 

, powershell, % 1 , .

the < NUL powershell ssh. , -, !

+2

Devnull , <NUL.

I tried to execute a Powershell command through a Cygwin Openssh connection with a Perl script on a remote computer. Instead of creating a batch file, I write Powershell commands to the ps1 file, passing it through scp, and then running it on top of ssh with the following Perl:

my ($stdout,$stderr) = Net::SSH->new( "user@host" )->capture2( { timeout => $timeout }, "powershell -file $copied_ps1_file<NUL");
0
source

All Articles