#! c:\perl\bin\perl.exe # mdmchk.pl # Script to detect modem drivers installed on NT systems # # usage: perl mdmchk.pl [name] # # copyright 2000 H.Carvey # for assistance, email keydet89@yahoo.com use strict; use Win32::TieRegistry(Delimiter=>"/"); my $server = shift || Win32::NodeName; \&mdmchk($server); sub mdmchk { my($server) = @_; my($remote); my ($mdm); my($modem) = 'SYSTEM/CurrentControlSet/Control/Class/'. '{4D36E96D-E325-11CE-BFC1-08002BE10318}'; if ($remote = $Registry->{"//$server/LMachine"}) { if ($mdm = $remote->{$modem}) { my @vals = $mdm->SubKeyNames; if ($#vals != -1) { print "Modem detected on $server...\n"; foreach my $subkey (@vals) { my $val = $mdm->{$subkey}; my $port = $val->GetValue("AttachedTo"); my $man = $val->GetValue("Manufacturer"); my $friend = $val->GetValue("FriendlyName"); print "\tPort:\t\t$port\n"; print "\tManufact:\t$man\n"; print "\tName:\t\t$friend\n"; } } else { print "No modem driver entries.\n"; } } else { my $err = Win32::FormatMessage Win32::GetLastError; print "Could not connect to modem Registry key: $err\n"; } } else { my $err = Win32::FormatMessage Win32::GetLastError; print "Could not connect to $server Registry: $err\n"; } }