Closed slbubba49 closed 8 years ago
Hi Warren
Thanks for your feedback.
I have not taken into account the case when we open another session from powershell session (here, you perform a Enter-pssession command).
When closing, JPowershell call 'exit' in order to finish the powershell session. However, in your case, the exit is executed in the remote session so the original powershell session is still active and I gives a timeout when waiting for close.
Can you try to close the remote session before closing JPowershell?
response = powerShell.executeCommand("Enter-pssession some-remote-system");
System.out.println("PSsession:" + response.getCommandOutput());
//Execute another command in the same PowerShell session
response = powerShell.executeCommand("Get-WmiObject Win32_BIOS");
System.out.println("BIOS information:" + response.getCommandOutput());
//Exit remote session
powerShell.executeCommand("exit");
} catch (PowerShellNotAvailableException ex) {
[....]
Thanks
I'll definitely take your suggestion. I hope my Email was helpful because, like I said before, you sure saved me some time by doing those classes.
Thanks
Warren
On Sat, Jun 11, 2016 at 9:00 AM, JGA notifications@github.com wrote:
Hi Warren
Thanks for your feedback.
I have not taken into account the case when we open another session from powershell session (here, you perform a Enter-pssession command).
When closing, JPowershell call 'exit' in order to finish the powershell session. However, in your case, the exit is executed in the remote session so the original powershell session is still active and I gives a timeout when waiting for close.
Can you try to close the remote session before closing JPowershell?
response = powerShell.executeCommand("Enter-pssession some-remote-system"); System.out.println("PSsession:" + response.getCommandOutput()); //Execute another command in the same PowerShell session response = powerShell.executeCommand("Get-WmiObject Win32_BIOS"); System.out.println("BIOS information:" + response.getCommandOutput()); //Exit remote session powerShell.executeCommand("exit"); } catch (PowerShellNotAvailableException ex) { [....]
Thanks
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/profesorfalken/jPowerShell/issues/8#issuecomment-225367903, or mute the thread https://github.com/notifications/unsubscribe/AS8FpygzxmtLDc34O3K_1b1sdCC9tUyXks5qKs12gaJpZM4IzBO7 .
--------- Cut Here -------------
Little by little we subtract Faith and fallacy from fact The illusory from the true And starve upon the residue.
S. Hoffenstein
Hope that the proposed solution worked Warren.
I close this issue since there is no activity in 24 days.
Thanks
First of all; thanks for doing this. It will save me a lot of time with my project.
The issue occurs during the PowerShell ".close" There is an exception:
Jun 10, 2016 8:12:58 AM com.profesorfalken.jpowershell.PowerShell waitUntilClose SEVERE: Unexpected error when closing PowerShell: TIMEOUT!
My environment is: NetBeans V8.x; JDK 1.8; jPowerShell-1.4.1.jar
Test code follows:
public class PowerShellTest {
Thanks
Warren