Skip to content

Commit 6c9270a

Browse files
committed
MAC Search optimized
1 parent b0934e2 commit 6c9270a

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

Scripts/New-IPv4NetworkScan.ps1

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -395,12 +395,16 @@ Begin{
395395
if(-not([String]::IsNullOrEmpty($Result.MAC)))
396396
{
397397
# Split it, so we can search the vendor (XX-XX-XX-XX-XX-XX to XX-XX-XX)
398-
$MACVendor_Search = $Job_Result.MAC.Replace("-","").Substring(0,6)
398+
$MAC_VendorSearch = $Job_Result.MAC.Replace("-","").Substring(0,6)
399399

400-
try {
401-
$Vendor = (($MAC_VendorList | Where-Object {$_.Assignment -eq $MACVendor_Search})[0])."Organization Name"
402-
}
403-
catch {}
400+
foreach($ListEntry in $MAC_VendorList)
401+
{
402+
if($ListEntry.Assignment -eq $MAC_VendorSearch)
403+
{
404+
$Vendor = $ListEntry."Organization Name"
405+
break
406+
}
407+
}
404408
}
405409

406410
$NewResult = [pscustomobject] @{
@@ -662,7 +666,7 @@ Process{
662666
Result = $Job.BeginInvoke()
663667
}
664668

665-
# Add Job to collection
669+
# Add job to collection
666670
[void]$Jobs.Add($JobObj)
667671
}
668672

0 commit comments

Comments
 (0)