Skip to content

Commit a23ebea

Browse files
committed
Code improved
1 parent 7922446 commit a23ebea

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

Scripts/IPv4NetworkScan.ps1

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -485,7 +485,7 @@ Process{
485485

486486
$PropertiesToDisplay += "Vendor"
487487

488-
$MAC_VendorList = Import-Csv -Path $CSV_MACVendorList_Path | Select-Object "Assignment", "Organization Name"
488+
$MAC_VendorList = Import-Csv -Path $CSV_MACVendorList_Path | Select-Object -Property "Assignment", "Organization Name"
489489
}
490490
else
491491
{
@@ -568,7 +568,7 @@ Process{
568568
if([String]::IsNullOrEmpty($MAC))
569569
{
570570
try{
571-
$Nbtstat_Result = nbtstat -A $IPv4Address | Select-String "MAC"
571+
$Nbtstat_Result = nbtstat -A $IPv4Address | Select-String -Pattern "MAC"
572572
$MAC = [Regex]::Matches($Nbtstat_Result, "([0-9A-F][0-9A-F]-){5}([0-9A-F][0-9A-F])").Value
573573
}
574574
catch{ } # No MAC
@@ -668,7 +668,7 @@ Process{
668668
# Process results, while waiting for other jobs
669669
Do {
670670
# Get all jobs, which are completed
671-
$Jobs_ToProcess = $Jobs | Where-Object {$_.Result.IsCompleted}
671+
$Jobs_ToProcess = $Jobs | Where-Object -FilterScript {$_.Result.IsCompleted}
672672

673673
# If no jobs finished yet, wait 500 ms and try again
674674
if($null -eq $Jobs_ToProcess)
@@ -680,7 +680,7 @@ Process{
680680
}
681681

682682
# Get jobs, which are not complete yet
683-
$Jobs_Remaining = ($Jobs | Where-Object {$_.Result.IsCompleted -eq $false}).Count
683+
$Jobs_Remaining = ($Jobs | Where-Object -FilterScript {$_.Result.IsCompleted -eq $false}).Count
684684

685685
# Catch when trying to divide through zero
686686
try {

0 commit comments

Comments
 (0)