Well I guess I should not post when I am tired. Does that sound better then posting without a license? ;-)

In your case that does make sense! 500 Servers ick. I was going to say why not automate but if you have 500 servers then you have a few thousand workstations. Right?

I only have about 350 machines total. The script I wrote checks all machines. I used the Roth NetAdmin mod to get a list of all NT/2000 workstations and servers. The only problem is that you have to build exclusion routines for stuff like Samba servers. But again in my case, people here would not always update the input file.

Why not build a ping into the routine. That way if a machine is down, you avoid the registry error when it tried to connect. I needed this because a few of our junior admins would go looking for the down machine and try and figure out why it did not have McAfee or Netshield installed! *SIGH*

A simple code:
my $p = Net::Ping->new("icmp"); if ($p->ping($computer)) { #run your checks } else { print"* Unable to Ping $computer *\n"; } $p->close(); }

Also this is strictly a choice of the person since there is no "real" noticible difference. But if you played with Connect option you could lesson some of your typing. As in:

if ($key = $Registry->Connect("$computer","LMachine/Software/Network A +ssociates/" . "TVD/NetShield NT/CurrentVersion/" {Access=>KEY_READ} ) ) { unless ($version = $key->GetValue("szProductVer")) { $version = "Unknown"; } unless ($dat = $key->GetValue("szVirDefVer")) { $dat = "Unknown"; } unless ($engine = $key->GetValue("szEngineVer")) { $engine = "Unknown"; } }

But this again is the choice of the person. For me if there was a typo, I would have to work at the long lines because I have dyslexia. So the chopped up lines make it a easier for me to read.

Oh did you know you could toss your delimeter up in the use statement? One less line....

use Win32::TieRegistry( Delimiter=>"/" );

How about a piece offering. This code will go out to the mcafee downloads site and get you the current dat, superdat and engine info. You will need LWP::UserAgent, HTTP::Request, and HTML::TableExtract(this is a slick mod).

For some strange reason the engine info comes out with a bunch of lines. Can't tell if NAI did something to their website or it is a bug. I think it is their site because it worked fine in the morning. You can correct this issue by resaving the engine var as an int

# # GetCurrentVersion will the Mcafee download page and grab the version + number # for the latest DAT, superDAT, and engine. sub GetCurrentVersion { my $key; my $dat; my $superdat; my $engine; my $html_code; my $row; my $ts; # # Lets access the Network Associates download page for the Virus I +nfo. my $ua = new LWP::UserAgent; my $url = 'http://www.mcafeeb2b.com/naicommon/download/dats/find.a +sp'; my $request = new HTTP::Request('GET',$url); # # Do we need to login? #$request->authorization_basic('login', 'password'); $ua->timeout(10); my $response = $ua->request($request); my $responsecode = $response->code(); # # Now we need to gather the information. if ($responsecode != 200) { print "Failed to Access the Mcafee site!: $responsecode\n"; } else { # # Load the HTML junk into a var. my @array = (split "\n", $ua->request($request)->as_string); foreach (@array) { $html_code .= $_ . "\n"; } } # # It's time to use TableExtract. We use the File Version and Date +for # header info to locate our tables. Once found; we look for certa +in # names and assing the version info to our needed vars. my $te = new HTML::TableExtract( headers => [qw(File Version Date) +] ); $te->parse($html_code); foreach $ts ($te->table_states) { #print "Table found at ", join(',', $ts->coords), ":\n"; foreach $row ($ts->rows) { # # DAT Version if (@$row[0] =~ /DAT File for weekly v4x \(DAT Only\)/) { #print "DAT = @$row[1]\n"; $dat = @$row[1]; } # # SuperDAT version which has both Engine and DAT. if (@$row[0] =~ /SuperDat File for v4x \(DAT \+ Engine\)/) + { #print "Superdat = @$row[1]\n"; $superdat = @$row[1]; } # # Engine only Version. if (@$row[0] =~ /Superdat File for v4x \(Intel Engine only +\)/) { $engine = @$row[1]; } #print " ", join(' , ', @$row), "\n"; } } return($dat, $superdat, $engine); }

So again I meant no disrespect. Sorry for such a wanky post.


In reply to My apologies by Marza
in thread McAfee Dat Check by OzzyOsbourne

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.