struct(wakeup): use list for target computers

- prevent future multiple read of database file
This commit is contained in:
Asif Bacchus 2021-09-05 17:25:15 -06:00
parent 939ff159f5
commit 56bc398bf0
1 changed files with 4 additions and 1 deletions

View File

@ -65,7 +65,10 @@ $broadcastIP = $db.WOLDatabase.Configuration.BroadcastAddress
$port = $db.WOLDatabase.Configuration.Port
$dnsSuffix = $db.WOLDatabase.Configuration.DnsSuffix
$db.WOLDatabase.Computers.Computer | Where-Object { $_.name -match "$targetComputer" } | ForEach-Object {
$targetComputers = [System.Collections.Generic.List[PSObject]]::new()
$db.WOLDatabase.Computers.Computer | Where-Object { $_.name -match "$targetComputer" } | ForEach-Object { $targetComputers.Add($_) }
$targetComputers | ForEach-Object {
if ( [String]::IsNullOrWhiteSpace($_.friendlyName))
{
$name = $_.name