From 3592f519a0bf1ed1a12674bf1f52893dd69aafa6 Mon Sep 17 00:00:00 2001 From: Asif Bacchus Date: Sat, 4 Sep 2021 02:26:10 -0600 Subject: [PATCH] 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 --- wol-magicPacket.psm1 | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/wol-magicPacket.psm1 b/wol-magicPacket.psm1 index 246e87f..7781fbb 100644 --- a/wol-magicPacket.psm1 +++ b/wol-magicPacket.psm1 @@ -3,7 +3,7 @@ Broadcast one or more "magic packets" across a subnet to wake-up one or more target computers. .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. @@ -101,11 +101,13 @@ function Send-MagicPacket continue } - # broadcast magic packet + # broadcast magic packets try { $UdpClient.Connect($BroadcastIP, $Port) $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)" } catch