Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re^4: Need to Execute msiexec using Net::Telnet

by tarunmudgal4u (Sexton)
on Aug 28, 2012 at 05:29 UTC ( #990136=note: print w/ replies, xml ) Need Help??


in reply to Re^3: Need to Execute msiexec using Net::Telnet
in thread Need to Execute msiexec using Net::Telnet

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.


Comment on Re^4: Need to Execute msiexec using Net::Telnet
Select or Download Code
Re^5: Need to Execute msiexec using Net::Telnet
by philiprbrenan (Monk) on Aug 28, 2012 at 13:16 UTC

    I am beginning to think that your Telnet session does not have enough priviledges to run msiexec, and that msiexec is objecting via a pop up which is ruining your telnet session. MS might have come to the conclusion that it would be bad for remote users to install software.

    If you wish to continue to the bitter end:

    So now we know that you can execute simple commands via telnet. The next command to execute is perl -v

    Then a perl script that executes the msiexec command for you. This script should be first tested on the target machine (i.e. not via telnet). Then via telnet.

    Once this has been done we know that msiexec can be started remotely and there is not some Windows weirdness that prevents it from happening, we can concentrate on the final step of eliminating the need for the perl wrapper on the target machine - which I agree is an excessive requirement in general but useful as a stepping stone to finding asolution.

    By taking these small steps we are eventually going to run into the actual problem that is occurring here, its tedious, but as Edison said: 1% inspiration, 99% perspiration.

      Hi Philip,

      Thanks for your help. As per your suggestion, I copied a Perl script on remote machine that executes the command line i was trying. Then I initiated this perl script on remote machine using local perl script that uses Net::telnet module. Please see below output I saw on the command line-

      C:\Compatibility_Automation_Temp>perl telnet_script1.pl command is: [perl C:\Compatibility_Automation_Temp\SepSepmInstall.pl - +i sep] output is: T h i s i n s t a l l a t i o n p a c k a g e c o u l d n o t + b e o p e n e d . V e r i f y t h a t t h e p a c k a g + e e x i s t s a n d t h a t y o u c a n a c c e s s i t , o r +c o n t a c t t h e a p p l i c a t i o n v e n d o r t o v + e r i f y t h a t t h i s i s a v a l i d W i n d o w s I n s t a +l l e r p a c k a g e . C:\Users\Administrator
      This simply says that we can't execute msiexec using remote mahcine :( (the same you predicted earlier). So is there any workaround for this like get the privilege to access this msiexec utility from remote machine.

      I fear that from here we are departing into that unknown country from whose bourne no traveler returns: namely Windows system administration. No doubt somewhere there is a method for granting Telnet the appropariate system priviledges. However, I suspect Microsoft will have their own ideas about how to do remote administration, and it may be better to abandon this approach for the moment and see what the standard MS way of doing this is. Once this is knowm, I am sure Perl will come back into play to drive their approved system programatically, but clearly, before advancing further we need to know how to do it manually.

        Hi Philip, there is a proper documentation available on Microsoft's site. please check it- http://technet.microsoft.com/en-us/library/ee156549.aspx

        The examples mentioned here are in powershell and I don't wanna use powershell. Please look at it and see if there is any way in Perl to handle the scenario.

Log In?
Username:
Password:

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

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

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











    Results (124 votes), past polls