feature(magicpacket): send multiple packets
- send 2 packets per MAC address, 1 second delay between packets - caters for a dropped packet or other transmission errors
This commit is contained in:
parent
0b8f04561b
commit
3592f519a0
@ -3,7 +3,7 @@
|
|||||||
Broadcast one or more "magic packets" across a subnet to wake-up one or more target computers.
|
Broadcast one or more "magic packets" across a subnet to wake-up one or more target computers.
|
||||||
|
|
||||||
.DESCRIPTION
|
.DESCRIPTION
|
||||||
Sends a configurable number of "magic packets" per supplied MAC address as a broadcast over the subnet using a specified UDP port. MAC addresses can be supplied directly or via the pipeline either with or without explicitly specifying a parameter. The broadcast address and UDP port can be specified via parameters.
|
Sends two (2) "magic packets" spaced one (1) second apart per supplied MAC address as a broadcast over the subnet using a specified UDP port. MAC addresses can be supplied directly or via the pipeline either with or without explicitly specifying a parameter. The broadcast address and UDP port can be specified via parameters.
|
||||||
|
|
||||||
Note: You must specify the '-Verbose' parameter to see output for successfully sent packets.
|
Note: You must specify the '-Verbose' parameter to see output for successfully sent packets.
|
||||||
|
|
||||||
@ -101,11 +101,13 @@ function Send-MagicPacket
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
# broadcast magic packet
|
# broadcast magic packets
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
$UdpClient.Connect($BroadcastIP, $Port)
|
$UdpClient.Connect($BroadcastIP, $Port)
|
||||||
$UdpClient.Send($magicPacket, $magicPacket.Length) | Out-Null
|
$UdpClient.Send($magicPacket, $magicPacket.Length) | Out-Null
|
||||||
|
Start-Sleep -Seconds 1
|
||||||
|
$UdpClient.Send($magicPacket, $magicPacket.Length) | Out-Null
|
||||||
Write-Verbose "Sent magic packet: Broadcast $addr over $BroadcastIP on port $Port (UDP)"
|
Write-Verbose "Sent magic packet: Broadcast $addr over $BroadcastIP on port $Port (UDP)"
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
|
Loading…
Reference in New Issue
Block a user