perlquestion
tarunmudgal4u
<p>Hi Monks,</p>
<p>There is one situation where I want to execute msiexec command line on remote machine using Net::Telnet.</p>
<p>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-</p>
<code>
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", Output_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\\Integration\\940\\DVD-SEP-EE\\SEPx64\\Sep64.msi \/norestart RUNLIVEUPDATE=0 \/l\*v C:\\Compatibility_Automation_Temp\\SepClientInstallLog.txt);
$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:\Compatibility_Automation_Temp\SepClientInstallLog.txt);
#$command = q(msiexec /q /i \\\\yy.yy.yy.yy\SEP_Builds\Jaguar\Integration\940\DVD-SEP-EE\SEPx64\Sep64.msi /norestart RUNLIVEUPDATE=0);
#$command = "ipconfig && net use J: \\\\yy.yy.yy.yy\\Public_Share\\Tarun";
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\\DVD-SEP-EE\\SEPx64\\Sep64.msi",
'/norestart', 'RUNLIVEUPDATE=0', '/l*v',
'C:\Compatibility_Automation_Temp\SepClientInstallLog.txt');
=cut
print "output is:\n@output\n";
exit;
</code>
<p>
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.
</p>
<p>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 <code>#$command = "ipconfig && net use J: \\\\yy.yy.yy.yy\\Public_Share\\Tarun";</code>). Here also, I get "command completed successfully" message in inputlogs.txt wherein I didn't see any mapped network drive on rempte machine later.</p>
<p>Can anybody please help me out?? I would really appreciate any help or suggestion.</p>