Hello gorgeous people who are reading this. Today i wanted to ask some help as i cant seem to move forward with this issue.
Im very new to coding and networking and all of that but i need to somehow use a script for wake on lan. This is really confusing though, and i barely comprehend anything of the scripts found on the internet.
What i need is just some simple help.
Take any script that you know that works for WOL and input the below info into it and share it with me and explain it please.
The PC details are 192.168.10.82 / 255.255.255.255 / 00:19:99:EB:27:FF
The above are the IP /Subnet /MAC. I have managed to use a 3rd party program to run the magic packet thing and it worked fine, the PC turned on from shutdown state just fine.
However i want to do this daily at a specific time and so i need to use a script with a scheduled task.
Please help me understand where the info i gave you fits into the script and how it all works please.
I still have no idea of how to use the thing above, the "Usage" has me super confused and the reply did not help me understand it any better so i played around with it for some time and changed it a bit.
param(
[string]$mac="XX:XX:XX:XX:XX:XX", <# REPLACE THE WANTED MAC HERE WITH YOUR OWN #>
[string]$ip="XXX.XXX.XXX.XXX", <# <-REPLACE THE WANTED IP HERE WITH YOUR OWN #>
[int]$port=9 <# Probably the port is 9 so leave it as it is#>
)
$broadcast = [Net.IPAddress]::Parse($ip)
$mac=(($mac.replace(":","")).replace("-","")).replace(".","")
$target=0,2,4,6,8,10 | % {[convert]::ToByte($mac.substring($_,2),16)}
$packet = (,[byte]255 * 6) + ($target * 16)
$UDPclient = new-Object System.Net.Sockets.UdpClient
$UDPclient.Connect($broadcast,$port)
[void]$UDPclient.Send($packet, 102)
As you can see above [string]$mac="XX:XX:XX:XX:XX:XX" part of the script and [string]$ip="XXX.XXX.XXX.XXX" are all you have to worry about, simply replace the X's with the details of the PC you want to wake up and you dont need to touch anything else.
Change the $MAC and $ip to what you need it to be, then you just saved it as wol.ps1 and simply right click it, run with powershell.
And youre done, it works perfectly fine so i still dont understand the above comment and how he planned on using it, but the above is srsly all anyone will ever need to make this run....
Enjoy and thank you for the help.