Compare commits
No commits in common. "b968fdf93e6a2cdd67bf97a5287e40a06dfdeaaf" and "f389999ca3021f2af54dddcc74dc08b66b2947a9" have entirely different histories.
b968fdf93e
...
f389999ca3
Binary file not shown.
@ -50,6 +50,7 @@ function Send-MagicPacket
|
|||||||
ValueFromPipelineByPropertyName,
|
ValueFromPipelineByPropertyName,
|
||||||
HelpMessage = "Please provide one or more MAC addresses. You may use a colon (:) or a hypen (-) to separate hex values."
|
HelpMessage = "Please provide one or more MAC addresses. You may use a colon (:) or a hypen (-) to separate hex values."
|
||||||
)]
|
)]
|
||||||
|
[ValidatePattern('^([0-9A-F]{2}[:-]){5}([0-9A-F]{2})$')]
|
||||||
[String[]]
|
[String[]]
|
||||||
$MacAddress,
|
$MacAddress,
|
||||||
|
|
||||||
@ -82,13 +83,6 @@ function Send-MagicPacket
|
|||||||
{
|
{
|
||||||
foreach ($addr in $MacAddress)
|
foreach ($addr in $MacAddress)
|
||||||
{
|
{
|
||||||
# validate MAC address format or write error and continue
|
|
||||||
if (!($addr -match '^([0-9A-F]{2}[:-]){5}([0-9A-F]{2})$'))
|
|
||||||
{
|
|
||||||
Write-Error "Invalid MAC address: $addr"
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
|
|
||||||
# convert MAC address to magic packet
|
# convert MAC address to magic packet
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@ -103,7 +97,7 @@ function Send-MagicPacket
|
|||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
Write-Error "Unable to process MAC address: $thisMacAddress"
|
Write-Warning "Unable to process MAC address: $thisMacAddress"
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -118,7 +112,7 @@ function Send-MagicPacket
|
|||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
Write-Error "Unable to send magic packet for '$addr'"
|
Write-Warning "Unable to send magic packet for '$addr'"
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user