This script is from win32scripting web site.  It does the same thing.

# showprogs.pl - Query remote NT machines for installed program list
# Syntax:
#    showprogs.pl <wait>
#  <wait> defaults to 10 seconds if no input
###############################################

use Win32::Registry;
use Net::Ping;
use Win32::Service;

my ($p, $node, $main, $hnode, $hkey, %values, @values, $wait, %serverstat);

if ($ARGV < 1)
 { # default to 10 second if no command line entries
 $wait = "10";
 }
else { # else accept first command line entry as wait value
 +$wait = $ARGV[0]; # only accept integers
 }

print "Enter a computer name ===> ";
while (($node=<STDIN>)=~m/.{17,}/)
 {
 print "The machine name must be 15 characters or less.\n";
 print "Please enter a valid machine name ===> ";
 }
chomp $node;

print "Connecting to $node...";
$p = Net::Ping->new("icmp");
if ($p->ping($node,$wait))
 {
 print "system is online...";
 Win32::Service::GetStatus("\\\\".$node, "LanManServer", \%serverstat) or
%serverstat = (CurrentState => "N/A");
 if ($serverstat{CurrentState} eq "4")
  {
  $node = "\\\\".$node;
  print "Services active...";
  $main::HKEY_LOCAL_MACHINE->Connect($node, $hnode) or die "Cannot connect to
$node";
  $hnode->Open("software\\microsoft\\windows\\currentversion\\uninstall",$hkey)
or die "nothing Installed\n";
  print "connected!\n\n";
  $hkey->GetKeys(\@values);
  $hkey->Close();

  print "Uninstall List for $node\n";
  print "------------------------------------\n";
  print "\[Keyname\] = DisplayName\n";
  print "------------------------------------\n";
  foreach (@values)
          {

$hnode->Open("software\\microsoft\\windows\\currentversion\\uninstall\\".$_,$hkey);

   $hkey->GetValues(\%values);
          print "\[$_\] = $values{DisplayName}[2]\n";
   }

  $hkey->Close();
  $hnode->Close();
  }
 elsif ($serverstat{CurrentState} ne "4")
  {
  print "Server inactive...";
  }
 }
else {
 print "unreachable...";
 }



"Morgan, Steve H." wrote:

> Here is the code I use for Audits.
>
> sub AuditInstalledSoftware
> {
>    my ($Server) = @_;
>    my @softkeys ;
>    my $key;
>    my $uninstall;
>    my $keys;
>    my $soft;
>    my %softInfo;
>
>    $Registry->Delimiter("/");                  # Set delimiter to "/".
>    $uninstall =
> $Registry->{"//$Server/HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows/Current
> Version/Uninstall"};
>    @softkeys =keys %{$uninstall};
>         foreach $key(@softkeys){                          #Check Uninstall
> keys to enumerate installed software
>                 $softInfo{$key} = $uninstall->{$key}->{'DisplayName'};
>         }
>    print
> "\n######################################################################\n"
> ;
>    print "# Installed Software
> #################################################\n";
>         foreach $soft(sort values %softInfo){
>                 unless(!$soft){
>                         print  "  $soft\n";
>                 }
>         }
> }
>
> -----Original Message-----
> From: Jangale V-S [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, April 09, 2002 11:04 AM
> To: '[EMAIL PROTECTED]'
> Subject: Installed softwares on NT
>
> Dear All,
>
> I want to get information about installed softwares on Windows NT 4 clients
> (Visible in Add/Remove Programs) using perl winthout using WMI !
>
> Can anybody guide me ??
>
> With Best Regards,
>
> V.S. Jangale
> _______________________________________________
> Perl-Win32-Admin mailing list
> [EMAIL PROTECTED]
> To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
> _______________________________________________
> Perl-Win32-Admin mailing list
> [EMAIL PROTECTED]
> To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

_______________________________________________
Perl-Win32-Admin mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to