mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-06-14 00:46:59 +02:00
Update wakeup.ps1
This commit is contained in:
parent
2e98da3600
commit
fe5712b02a
@ -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(".","")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user