Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
# Before you run this make sure you create a directory on your # c drive called "thegoods", and then under that directory create # "machines" and "software". # # Drop me a line if you have any questions, comments, or improvements. # # Chad Juettner - cjuettner@gmail.com use Win32::NetAdmin; use Win32::Registry; chdir "c:\\thegoods\\machines"; print "Is there more than one domain you'd like to check? (y/n) "; $stf = <STDIN>; if ($stf =~ /y|n/i) { if ($stf =~ /y/) { print "\nEnter the domains you'd like to query, separa +ted\nby a space (ex. DOMAIN1 DOMAIN2): "; $domains = <STDIN>; @doms = split (/ /, $domains); foreach $dom ( @doms ) { chomp $dom; print "Getting machine names for $dom...\n\n"; Win32::NetAdmin::GetServers( '', $dom, SV_TYPE +_ALL, \@$dom ); push (@servers, @$dom); } } if ($sty=~ /n/) { Win32::NetAdmin::GetServers( '', '', SV_TYPE_ALL, \@se +rvers ); } } else { print "You have to enter either y or n."; exit 1; } foreach $machine ( @servers ) { if ( $HKEY_LOCAL_MACHINE->Connect( $machine, $software ) ) { my @programs; open( CURRENT, ">" . $machine . ".txt" ); $software->Open( "software\\microsoft\\windows\\curren +tversion\\uninstall", $installed ); unless ( defined($installed) ) { next }; $installed->GetKeys( \@programs ); print "Getting programs out of HKLM for $machine\n"; foreach $program ( @programs ) { print CURRENT "$program\n"; } $software->Close; $installed->Close; close( CURRENT ); } if ( $HKEY_USERS->Connect( $machine, $hku ) ) { my @hkusubkeys; open( CURRENT, ">>" . $machine . ".txt" ); $hku->Open( '', $hkusers ); $hkusers->GetKeys( \@hkusubkeys ); foreach $subkey ( @hkusubkeys ) { my @subkeyprograms; if ( $subkey eq ".DEFAULT" ) { next } $HKEY_USERS->Connect( $machine, $currentsubkey + ); print "Getting programs out of HKU for $machin +e\n"; $plethora = $subkey . "\\software\\microsoft\\ +windows\\currentversion\\uninstall"; if ( $currentsubkey->Open( $plethora, $subkins +talled ) ) { $subkinstalled->GetKeys( \@subkeyprogr +ams ); foreach $skp ( @subkeyprograms ) { print CURRENT "$skp\n"; } } } $hku->Close; $hkusers->Close; close( CURRENT ); } } print "\n\nBuilding reports...\n"; chdir "c:\\thegoods"; unlink "c:\\thegoods\\report.txt"; unlink <c:\\thegoods\\software\\*>; opendir (GOODS, "c:\\thegoods\\machines") || die "cannot get to the go +ods: $!"; while ($name = readdir(GOODS)) { print "Built report: $name\n"; $total += 1; open (CURRENT, "c:\\thegoods\\machines\\" . $name); while ($line = <CURRENT>) { if ($line =~ /Connecting to remote machine/) { next } if ($line =~ /network path was not found/) { $total--; nex +t } if ($line eq "\n") { next } if ($line =~ /{/) { next } $line =~ s/\[//; $line =~ s/\]//; chop $line; $length = @$line; $machinename = $name; $machinename =~ s/.txt//; @$line[$length] = $machinename; $list{$line} += 1; chdir "c:\\thegoods\\software"; open (SOFTWARE, ">>$line" . ".txt"); print SOFTWARE "@$line[$length]\n" unless ($line[$length] +eq "\n"); chdir "c:\\thegoods"; } } closedir(GOODS); print "\n\nMaking report.txt...\n\n"; open (REPORT, ">c:\\thegoods\\report.txt"); print REPORT "Total machines queried: $total\n\n"; foreach $install (sort keys(%list)) { print REPORT ("$install: $list{$install}\n"); } print "All done.\n";

In reply to thegoods.pl by hendrix

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, 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, 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.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others imbibing at the Monastery: (3)
    As of 2021-01-21 02:48 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?
      Notices?