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

Windows Service Pack Information

by martymart (Deacon)
on Apr 17, 2008 at 15:14 UTC ( [id://681184]=perlquestion: print w/replies, xml ) Need Help??

martymart has asked for the wisdom of the Perl Monks concerning the following question:

Fellow Monks,

I am looking for a module that will help me grab windows service pack information from a particular windows machine. The script will be living and working on a solaris box. I can do this easily enough from a windows machine by capturing the output from srvinfo.exe, or some similar executable. But doing this from a solaris machine has me stumped. If anyone has any suggestions I would appreciate it.

Thanks in advance,
Martymart

Replies are listed 'Best First'.
Re: Windows Service Pack Information
by mr_mischief (Monsignor) on Apr 17, 2008 at 15:43 UTC
    If you have an SSH server on the Windows machine, you could use Net::SSH, Net::SSH2, or Net::SSH::Perl to run the command and grab the output.

    The Service Pack is one of the values exposed through Active Directory. You can use pretty much any LDAP client, with a little work, to talk to Active Directory since it is essentially YALI (Yet Another LDAP Implementation). There's a somewhat light-hearted article about how to get the information using ADO over at Dr. Scripto's Script Shop on MS TechNet. You should be able to query the same information using Net::LDAP, which has a nice HOWTO at Linux Journal. There's much more about LDAP at BIND 9.

Re: Windows Service Pack Information
by pc88mxer (Vicar) on Apr 17, 2008 at 15:42 UTC
    I'd probably set up an ssh daemon on the windows boxes so the Solaris machine can login and grab the output of srvinfo.exe. You can lock things down so that only specific commands can be executed.

    If that's not possible, an alternative is to set up a Windows service that will give you the output of srvinfo.exe when you connect to it. The Windows service could be written in perl. You could even do it with a web server.

    There might be some other possibilities using MS remote procedure call technologies.

Re: Windows Service Pack Information
by BrowserUk (Patriarch) on Apr 17, 2008 at 15:54 UTC

    Are the client machines in a secure network? If so, can you have the rsh service enabled on them?

    If so, you could do something like:

    my %configs; for my $host ( @hosts ) { %configs{ $host } = qx[ rsh $host -l user -n srvinfo]; }

    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.

      If you have rsh enabled on it then I'd think most security types would say that by definition don't have a secure network . . . :)

      (Seriously there's better alternatives (such as ssh as was recommended elsewhere in the thread) that aren't gaping vulnerabilities begging to be exploited (they're smaller potential vulnerabilities which under active attack and countermeasure development :).)

      The cake is a lie.
      The cake is a lie.
      The cake is a lie.

Re: Windows Service Pack Information
by roboticus (Chancellor) on Apr 17, 2008 at 15:58 UTC
    martymart:

    You might check to see if you can access the service pack information from WMI, and (of course) whether you can get your Solaris box to access WMI. (A brief scan of CPAN yields DBD::WMI which might do what you want.)

    ...roboticus

    who hasn't used Solaris since v2

Re: Windows Service Pack Information
by Anonymous Monk on Apr 17, 2008 at 15:21 UTC
    Reverse engineer srvinfo?

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://681184]
Approved by moritz
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (3)
As of 2024-09-09 04:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    erzuuli‥ 🛈The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.