![]() |
Psexec - input redirection to a remote exe - is th |
Post Reply
|
| Author | |
kirannhegde
Newbie
Joined: 03 August 2012 Status: Offline Points: 7 |
Post Options
Thanks(0)
Quote Reply
Topic: Psexec - input redirection to a remote exe - is thPosted: 04 October 2012 at 7:00am |
|
Description of my scenario: I am using PsExec to remotely launch an in house utility which prints certain records on the command prompt. When this utility is launched on the command prompt by logging into the remote server, the utility works fine. It is able to print all the records which is expected out of it. However, when the utility is launched remotely using Psexec , the utility hangs. Basically this is what we do to launch the exe remotely: i)Connect to the remote server as an Upon further investigation, it was found out that the utility makes use of an API called ReadConsoleInput(). (http://msdn.microsoft.com/en-us/library/windows/desktop/ms684961(v=vs.85).aspx) There is logic in the utility to print records on the command prompt with a page size of 23 records and then waits for the user input.ReadConsoleInput() waits for an user input before the next page of records is displayed. This API does not return until at least one record is read from the Console input buffer. Since Psexec does not redirect the keystrokes back to the remote server, the function waits indefinitely.This results in a hang. Is this a known issue? If yes, how do i get this scenario working? Any alternatives? Are there any documented workarounds? Any help would be very much appreciated. Thanks |
|
![]() |
|
spatters
Newbie
Joined: 27 September 2012 Status: Offline Points: 12 |
Post Options
Thanks(0)
Quote Reply
Posted: 04 October 2012 at 12:33pm |
|
I think maybe if you call the utility in another thread using the start command it will work
For example, instead of this...
...which will kick off utility under a separate command prompt that doesn't have input redirection. |
|
![]() |
|
spatters
Newbie
Joined: 27 September 2012 Status: Offline Points: 12 |
Post Options
Thanks(0)
Quote Reply
Posted: 04 October 2012 at 12:35pm |
|
<brag>BTW here is a batch file I wrote that makes great use of this concept</brag> :)
|
|
![]() |
|
kirannhegde
Newbie
Joined: 03 August 2012 Status: Offline Points: 7 |
Post Options
Thanks(0)
Quote Reply
Posted: 09 October 2012 at 9:01am |
|
Hello,
Thanks for the responses. Could you kindly clarify on what you mean with your above statements? Regards, Kiran Hegde
|
|
![]() |
|
aaronmar
Moderator Group
Joined: 13 July 2010 Status: Offline Points: 58 |
Post Options
Thanks(0)
Quote Reply
Posted: 09 October 2012 at 6:53pm |
|
My guess (just a guess) is that if the console app doesn't accept redirection of standard input and only accepts actual console input, it's going to be stuck. Any chance it could be rewritten to accept standard input instead of insisting on console input?
|
|
|
-- Aaron Margosis (Microsoft)
co-author of The Windows Sysinternals Administrator's Reference. http://www.amazon.com/Windows-Sysinternals-Administrators-Reference-Russinovich/dp/073565672X |
|
![]() |
|
kirannhegde
Newbie
Joined: 03 August 2012 Status: Offline Points: 7 |
Post Options
Thanks(0)
Quote Reply
Posted: 10 October 2012 at 5:19am |
|
Let me see if that is an option to get this issue fixed.
|
|
![]() |
|
Post Reply
|
|
|
Tweet
|
| Forum Jump | Forum Permissions ![]() You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |