Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C++ Win32
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 adminstrator using psexec and open a remote cmd.exe psexec \ -u -p cmd.exe ii)Launch the utility from the remote cmd.exe
 
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.
 
Thank
Posted 8-Oct-12 23:33pm
Edited 8-Oct-12 23:49pm
(no name)399.4K
v2
Comments
Richard MacCutchan at 9-Oct-12 4:50am
   
You need to change your utility so it does not wait for console input.
Andrew Cherednik at 9-Oct-12 6:42am
   
I think this question will be best answered here:
http://forum.sysinternals.com/forum_topics.asp?FID=8&title=pstools

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Richard MacCutchan 269
1 Aajmot Sk 252
2 Marcin Kozub 235
3 Sergey Alexandrovich Kryukov 185
4 Praneet Nadkar 167
0 OriginalGriff 7,913
1 Sergey Alexandrovich Kryukov 7,232
2 DamithSL 5,604
3 Manas Bhardwaj 4,986
4 Maciej Los 4,865


Advertise | Privacy | Mobile
Web02 | 2.8.1411023.1 | Last Updated 9 Oct 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100