How to pass Y in batch file

rfwilkinson

Commendable
Aug 11, 2016
2
0
1,510
0
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?
 

hang-the-9

Titan
Moderator
How often is this run? You can't remote into the servers and run this manually?

How about using the scheduler to run the script at a certain time and copy the script locally to the servers.

I was never good at using psexec to get it going.
 

rfwilkinson

Commendable
Aug 11, 2016
2
0
1,510
0


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..
'VBScript Example
Set WshShell = WScript.CreateObject("WScript.Shell")

WshShell.Run "C:\Deployable_Packages\20160811e_Appsuite_Importers\AXUpdateInstaller.exe import -runbookfile=C:\Deployable_Packages\20160811e_Appsuite_Importers\20160811e_Appsuite_Importers.xml"
WshShell.AppActivate "AXUpdateInstaller"
Wscript.Sleep 13500

WshShell.SendKeys "Y"


 

hang-the-9

Titan
Moderator
How often is this run? You can't remote into the servers and run this manually?

How about using the scheduler to run the script at a certain time and copy the script locally to the servers.

I was never good at using psexec to get it going.
 
Thread starter Similar threads Forum Replies Date
David___Only Apps General Discussion 0
S Apps General Discussion 4
M Apps General Discussion 3
D Apps General Discussion 2
N Apps General Discussion 1
NoctisLionward Apps General Discussion 2
malavena Apps General Discussion 3
Tom Waller Apps General Discussion 2
P Apps General Discussion 1
S Apps General Discussion 4
A Apps General Discussion 13
Z Apps General Discussion 1
P Apps General Discussion 7
G Apps General Discussion 0
T Apps General Discussion 5
SHADOWSTRIKE1 Apps General Discussion 3
S Apps General Discussion 3
P Apps General Discussion 2
M Apps General Discussion 3
ChaoticWolf Apps General Discussion 30

ASK THE COMMUNITY