diff --git a/wakeup.ps1 b/wakeup.ps1 index 9518a1e..d3b4900 100644 --- a/wakeup.ps1 +++ b/wakeup.ps1 @@ -3,9 +3,9 @@ param ( -# Computer to wake up +# Array of strings listing computer name(s) to wake up. Names will be matched using RegEx [Alias("Computer")] - [String] + [String[]] $TargetComputer = "", # XML database file containing computer details [Alias("List", "database", "db")] @@ -89,7 +89,10 @@ $broadcastIP = $db.WOLDatabase.Configuration.BroadcastAddress $port = $db.WOLDatabase.Configuration.Port $dnsSuffix = $db.WOLDatabase.Configuration.DnsSuffix $targetComputers = [System.Collections.Generic.List[PSObject]]::new() -$db.WOLDatabase.Computers.Computer | Where-Object { $_.name -match "$TargetComputer" } | ForEach-Object { $targetComputers.Add($_) } +$TargetComputer | ForEach-Object { + $tgt = $_ + $db.WOLDatabase.Computers.Computer | Where-Object { $_.name -match $tgt } | ForEach-Object { $targetComputers.Add($_) } +} $removeFromTargetComputers = [System.Collections.Generic.List[String]]::new() # exit if nothing to do (i.e. empty targetComputers list)