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.
- This backslash
\ $ pwd is not doing anything - 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
Post a Comment