Update wakeup.ps1

This commit is contained in:
Markus Fleschutz 2021-10-07 11:22:28 +02:00 committed by GitHub
parent 2e98da3600
commit fe5712b02a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2,10 +2,16 @@
.SYNOPSIS .SYNOPSIS
Sends a magic packet to a computer to wake him up Sends a magic packet to a computer to wake him up
.DESCRIPTION .DESCRIPTION
Sends a magic packet to a computer to wake him up (requires Wake-On-LAN) Sends a magic UDP packet twice to a computer to wake him up (requires Wake-On-LAN).
wakeup.ps1 [<MAC-address>] [<IP-address>] .PARAMETER MACaddress
Specifies the host's MAC address (e.g. 11:22:33:44:55:66)
.PARAMETER IPaddress
Specifies the host's IP address or subnet address (e.g. 255.255.255.255)
.PARAMETER Port
Specifies the UDP port (9 by default)
.EXAMPLE .EXAMPLE
PS> ./wakeup 11:22:33:44:55:66 192.168.100.100 PS> ./wakeup 11:22:33:44:55:66 192.168.100.100
(PC wakes up)
.NOTES .NOTES
Author: Markus Fleschutz · License: CC0 Author: Markus Fleschutz · License: CC0
.LINK .LINK
@ -14,7 +20,7 @@
param([string]$MACaddress = "", [string]$IPaddress = "", [int]$Port=9) param([string]$MACaddress = "", [string]$IPaddress = "", [int]$Port=9)
function Send-WOL { param([string]$mac, [string]$ip="255.255.255.255", [int]$port=9) function Send-WOL { param([string]$mac, [string]$ip, [int]$port)
$broadcast = [Net.IPAddress]::Parse($ip) $broadcast = [Net.IPAddress]::Parse($ip)
$mac=(($mac.replace(":","")).replace("-","")).replace(".","") $mac=(($mac.replace(":","")).replace("-","")).replace(".","")