#Eingabedatei
$InputFile = "\\IP vom SynoNAS im gleichen Netz wie der PC der aufwachen soll\WakeOnLanMAC.txt"
function Send-Packet([string]$MacAddress)
{
try
{
$Broadcast = ([System.Net.IPAddress]::Broadcast)
## Create UDP client instance
$UdpClient = New-Object Net.Sockets.UdpClient
## Create IP endpoints for each port
$IPEndPoint = New-Object Net.IPEndPoint $Broadcast, 9
## Construct physical address instance for the MAC address of the machine (string to byte array)
$MAC = [Net.NetworkInformation.PhysicalAddress]:

arse($MacAddress.ToUpper())
## Construct the Magic Packet frame
$Packet = [Byte[]](,0xFF*6)+($MAC.GetAddressBytes()*16)
## Broadcast UDP packets to the IP endpoint of the machine
$UdpClient.Send($Packet, $Packet.Length, $IPEndPoint) | Out-Null
$UdpClient.Close()
}
catch
{
$UdpClient.Dispose()
$Error | Write-Error;
}
}
#Fuer jede MAC in Zeile: Function 'Send-Paket + MAC'
ForEach ($MacAddress in get-content $InputFile)
{
Send-Packet $MacAddress
}
Quelle:
https://www.itnator.net/wake-lan-script-wol/