I am trying to automate a process that spans several servers and am using batch files and PSEXEC to accomplish that. I have it all working but am running into one issue. I am running a command remotely that requires a Y to confirm the action. There is no quiet mode, /y flag, or any other argument that I can see to get around this. I have tried to put a pipe |Y on the end of the psexec line, I have tried a batch file with echo Y| on the front and |Y on the end. Every time, I get a "Cannot read keys when either application does not have a console or when console input has been redirected from a file. Try Console.Read." message... Any help?
Use a different scripting method. VBScript can send key presses to the system https/social.technet.microsoft.com/wiki/contents/articles/5169.vbscript-sendkeys-method.aspx
Thanks for the suggestion. I now have a VBS file (see code below) and it runs fine when on the actual system but when run using psexec.exe \\servername cscript c:\script.vbs (also tried -i and wscript), it exists with an error level of 0 and it stays up for the complete "wait" time. But it isn't running..
Set WshShell = WScript.CreateObject("WScript.Shell")