Hi Monks,

There is one situation where I want to execute msiexec command line on remote machine using Net::Telnet.

When I execute some simple ipconfig/hostname like commands, I get proper output. but when I execute msiexec with multiple long parameters, it doesn't work. Please see below script-

use Net::Telnet; BEGIN { $|=1 } $user = "administrator"; $pass = 'abc'; $telnet = new Net::Telnet ( Timeout=>20, Errmode=>'die', Prompt => '/[ +%#>] ?$/', Dump_Log=>"dumplogs.txt", Input_log=>"inputlogs.txt", Outp +ut_log=>"outputlogs.txt"); $telnet->open('xx.xx.xx.xx'); $telnet->login(Name=>$user, Password=>$pass, Prompt=>'/[%#>:] ?$/'); #$command = qq(msiexec \/qn \/i \\\\yy.yy.yy.yy\\SEP_Builds\\Jaguar\\I +ntegration\\940\\DVD-SEP-EE\\SEPx64\\Sep64.msi \/norestart RUNLIVEUPD +ATE=0 \/l\*v C:\\Compatibility_Automation_Temp\\SepClientInstallLog.t +xt); $command = q(msiexec /i \\\\yy.yy.yy.yy\SEP_Builds\Jaguar\Integration\ +940\DVD-SEP-EE\SEPx64\Sep64.msi /norestart RUNLIVEUPDATE=0 /l*v C:\Co +mpatibility_Automation_Temp\SepClientInstallLog.txt); #$command = q(msiexec /q /i \\\\yy.yy.yy.yy\SEP_Builds\Jaguar\Integrat +ion\940\DVD-SEP-EE\SEPx64\Sep64.msi /norestart RUNLIVEUPDATE=0); #$command = "ipconfig && net use J: \\\\yy.yy.yy.yy\\Public_Share\\Ta +run"; print "command is: [$command]\n"; @output = $telnet->cmd(String=>$command); =cut @output = $telnet->cmd(join ' ', 'C:\Windows\System32\msiexec.exe', '/q', '/i', "\\\\yy.yy.yy.yy\\SEP_Builds\\Jaguar\\Integration\\940\\DV +D-SEP-EE\\SEPx64\\Sep64.msi", '/norestart', 'RUNLIVEUPDATE=0', '/l*v', 'C:\Compatibility_Automation_Temp\SepClientInstallLog.txt' +); =cut print "output is:\n@output\n"; exit;

Here, I've tried different ways to create my command line, but, none of them worked. From my local machine, when I execute this script, output shows command ran successfully on remote machine yy.yy.yy.yy but when I check it personally on yy.yy.yy.yy machine, this command didn't get executed there. Then I ran the same command on remote machine which i'm able to see inside "inputlogs.txt" file and it ran successfully.

While investing more on this, I ran a command to map my shared network drive on remote machine. you can also see this command in the above code(I've commented out that line #$command = "ipconfig  && net use J: \\\\yy.yy.yy.yy\\Public_Share\\Tarun";). Here also, I get "command completed successfully" message in inputlogs.txt wherein I didn't see any mapped network drive on rempte machine later.

Can anybody please help me out?? I would really appreciate any help or suggestion.


In reply to Need to Execute msiexec using Net::Telnet by tarunmudgal4u

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.