Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re: Need to Execute msiexec using Net::Telnet

by philiprbrenan (Monk)
on Aug 26, 2012 at 22:15 UTC ( #989885=note: print w/ replies, xml ) Need Help??


in reply to Need to Execute msiexec using Net::Telnet

Could you clean up your example removing all extraneous information, comments, etc. Place a say dump($command) just before the failing statement so that we can see exactly what is being executed. Please make sure you are including /q in the command string so that msi does not attempt to start in GUI mode. Also, please make sure that you are presenting the smallest possible command that does in fact fail with all possible defaults taken so that the failure can be localized as much as possible.

As you are telnetting, you should not need an ip or host name at the front of your file name, it should be a local file on the target machine.

Ideally you should run the desired command on the target machine (by walking over to it and typing it in) to prove that you have the correct syntax before attempting to execute the command via telnet.

Could you also demonstrate that you can run simple commands like "dir", "cd" etc. via telnet to prove that the environment is operational.

These actions should make the cause of the failure much clearer.

Thanks


Comment on Re: Need to Execute msiexec using Net::Telnet
Re^2: Need to Execute msiexec using Net::Telnet
by tarunmudgal4u (Sexton) on Aug 27, 2012 at 06:57 UTC

    Hi Philip,

    I used these commented lines just to show that I've tried all these options, but, none of them is working :(. For you, I've copied lines of code that is being executed. Please see below code-

    use Net::Telnet; BEGIN { $|=1 } $user = "administrator"; $pass = 'pass'; $telnet = new Net::Telnet ( Timeout=>20, Errmode=>'die', Prompt => '/[ +%#>] ?$/', Dump_Log=>"dumplogs.txt", Input_log=>"inputlogs.txt", O +utput_log=>"outputlogs.txt"); $telnet->open('xx.xx.xx.xx'); $telnet->login(Name=>$user, Password=>$pass, Prompt => '/[%#>:] ?$/'); $command = qq(msiexec \/qn \/i \\\\10.210.156.150\\SEP_Builds\\Jaguar\ +\Integration\\940\\DVD-SEP-EE\\SEPx64\\Sep64.msi \/norestart RUNLIVEU +PDATE=0 \/l\*v C:\\Compatibility_Automation_Temp\\SepClientInstallLog +.txt); print "command is: [$command]\n"; @output = $telnet->cmd(String=>$command); print "output is:\n@output\n"; exit;
    The output of this command seen from the "inputlogs.txt" is mentioned below-
    Welcome to Microsoft Telnet Service login: administrator password: *=============================================================== Microsoft Telnet Server. *=============================================================== C:\Users\Administrator>msiexec /qn /i \\10.210.156.150\SEP_Builds\Jagu +ar\Integration\940\DVD-SEP-EE\SEPx64\Sep64.msi /norestart RUNLIVEUPDA +TE=0 /l*v C:\Compatibility_Automation_Temp\SepClientInstallLog.txt C:\Users\Administrator>
    Now, if I copy and paste the same command I see in inputlogs.txt file, this command works well on remote mahcine. but using this script, it doesn't. Please help me with this.

      We are making progress. The nest step is to prove that you can execute a simple command on the target machine via Telnet. The ideal command would be perl -v so that we can see that we can start perl remotely. Once that done we can put the desired msiexec command in a perl script on the target machine and start that. So: can you execute perl remotely via Telnet on the target machine?

        Hi Philip,

        Here, I want to mention a point. Actually, I wanted to remove the dependencies of installing something on remote machine. That is why I came up with this "Telnetting" idea. Otherwise, earlier I was doing this stuff using Jenkins(a tool that allows us to add client machine and fire commands on the client). In that case, there were so many dependencies of installing Java, Perl with required modules etc. So, I thought to get rid of it and just use telnetting and fire commands from there. In this way, I don't require to install anything on remote machine. just need one machine with everything installed as a server from where I can initiate this telnet script.

        I hope, you have understood my problem. Now, as you were asking about any simple command to run using this script, please see below script with its output-

        use Net::Telnet; BEGIN { $|=1 } $user = "administrator"; $pass = 'crt@123'; $telnet = new Net::Telnet ( Timeout=>20, Errmode=>'die', Prompt => '/[ +%#>] ?$/', Dump_Log=>"dumplogs.txt", Input_log=>"inputlogs.txt", O +utput_log=>"outputlogs.txt"); $telnet->open('10.217.50.218'); $telnet->login(Name=>$user, Password=>$pass, Prompt => '/[%#>:] ?$/'); $command = qq(ipconfig && hostname); print "command is: [$command]\n"; @output = $telnet->cmd(String=>$command); print "output is:\n@output\n"; exit;
        And the output of this script is-
        C:\Compatibility_Automation_Temp>perl test1.pl command is: [ipconfig && hostname] output is: Windows IP Configuration Ethernet adapter Local Area Connection: Connection-specific DNS Suffix . : crt.com Link-local IPv6 Address . . . . . : fe80::a489:bdd0:bbd7:748a%11 IPv4 Address. . . . . . . . . . . : 10.217.50.218 Subnet Mask . . . . . . . . . . . : 255.255.252.0 Default Gateway . . . . . . . . . : 10.217.48.1 Tunnel adapter isatap.crt.com: Media State . . . . . . . . . . . : Media disconnected Connection-specific DNS Suffix . : crt.com WIN-3K3OARCE05I C:\Users\Administrator
        Here, you can see it's working fine. Please suggest me for further.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://989885]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (13)
As of 2014-09-22 18:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (198 votes), past polls