use strict; use Win32::OLE; use Win32::OLE::Variant; use Net::Ping; use Date::EzDate; use Spreadsheet::WriteExcel; use warnings; use Win32::OLE qw(in with); sub regCheck { my $server = $_[0]; my $exists = 0; my $refRegistry = Win32::OLE->GetObject("winMgmts://$server/root/default:StdRegProv" ) or die "cannot get object\n"; my @search = ('\\xxxxx','\\public'); my $HKEY_LOCAL_MACHINE = 0x80000002; my $strSKPath="SYSTEM\\CurrentControlSet\\Services\\SNMP\\Parameters\\TrapConfiguration"; my $strValueName="1"; my $count = 1; foreach(@search) { my $value = Variant(VT_BSTR | VT_BYREF, ""); my $newPath = $strSKPath . $_; $refRegistry->GetStringValue($HKEY_LOCAL_MACHINE, $newPath,$strValueName, $value); #Ignore this part #if($value != 0) #{ # print OUTFILE "Regvalue is null\n"; #} #else #{ #if($value =~ m/^*xxxxxx.com*+/) #{ # $exists = 1; #} #} $count++; } return $exists; }