Not able Execute multiple command in remote Machine Using PSEXEC through Perl script -


Trying to connect to a remote machine, psexec and trying to execute several commands,

The execution is hanging when the Sieb server manager is trying to connect and execute some related commands

  system ("cmd /cc:\\PsExec.exe \\ \\ $ host_name -u $ user_name -p \ $ pwd CMD / C \ "$ Command1 & amp; Srvrmgr / g Enterprise Server / U Username / P Password / E-Sibel / s siebserver / c \" conform to CMD \ "\" To add "");   

I am running commands through Perl script, capable of running other commands, the only issue is when I connect to Server Manager and try to execute some related commands

Need to debug avoids:

  Usage 5.012; My $ host_name = 'HOST_NAME'; My $ user_name = 'USER_NAME'; My $ pwd = 'PWD'; My $ command1 = 'COMMAND1'; My $ CMD = "CMD / C: \\ PsExec.exe \\\\ $ host_name -u $ user_name -p \ $ pwd cmd / c \" $ command1and; Srvrmgr / g Enterprise Server / U Username / P Password / e siebel / s siebserver / c \ "Run CMD \" \ ""; Print $ CMD;   

Output:

  CMD / CCSAPXAC.exe \\ HOST_NAME -U-USER_NAME -P PWD CMD / C "Comman 1 & amp; ARVRMRGR  

Some notes.

  1. This backslash \ $ pwd is not doing anything
  2. This double quote "CMD to execute" possibly needs to be saved at the shell level.

    Additionally, if you Creating a command that contains double quotes, then It is a good idea to use a different delimiter to create your string.

    Of the following, your command will be restored.

      My $ cmd = qq { Cmd /cc:\\PsExec.exe \\\\ $ host_name -u $ user_name -p $ pwd CMD / C "$ command1 & amp; ; & Amp; Srvrmgr / g Enterprise Server / U user name / p password / e siebel / s siebserver / c \\ "cmd to run \" "};    

Comments

Popular posts from this blog

java - ImportError: No module named py4j.java_gateway -

python - Receiving "KeyError" after decoding json result from url -

.net - Creating a new Queue Manager and Queue in Websphere MQ (using C#) -