How to Schedule A Task To Wake On Lan (WOL) All Other Computers (PCs) On A Network After I Start My Main Computer In Windows 7 Without Extra Applications

I have searched through google and there seems to be many ways to do this but most you have to install some sort of application. This is a learning curve for me but basically I have 4-5 other computers on a network that when I start the main computer (PC1) I want the other 4-5 computers to power on also.

I have experience with running scheduled tasks and I have enabled in the bios and my network cards to Wake On Lan (WOL). I have set automatic startups before using the task scheduler but this is not what I need. My schedule is to erratic.

It appears I need to send a "Magic Packet" and this is new to me. I am hoping I can run a Script of some kind in the task scheduler to send these magic packets out to the other PCs. I am using windows 7 on all the PCs.

Thank you for the help!
LVL 1
Dustin StanleyEntrepreneurAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Hello ThereSystem AdministratorCommented:
First, all NICs must support WOL.
0
arnoldCommented:
Wol requires the receipt of a Magic packet on a Nic that has wol enabled.
The magic packet has to be addressed to the physical address of the nic, MAC Address.

The process would be to install the network application capable of transmitting this magic packet, and the scheduled task is to run the task on boot, sending packets to each system

Are the distances among all the computers so vast or phrased better, I understand a dependency of all on the 1st computer that needs to be powered up first, what is the interdependency among the remaining?
0
Hello ThereSystem AdministratorCommented:
Second, you cannot do it via Task Scheduler on clients.
It's scheduler. You need to know WHEN to do the action. I mean you need to know the time. E.G. every day at 8 a.m. and so, every two hours.

But you might be able to send WOL via PS1 on your main computer... Maybe you will be able to do it via Task Scheduler if you will run it on startup. Then it will send a magic packet to clients... But I have never tried this...
https://gallery.technet.microsoft.com/scriptcenter/Send-WOL-packet-using-0638be7b
0
Top Threats of Q1 & How to Defend Against Them

WEBINAR: Join WatchGuard CTO and our Threat Research Team on Aug. 2nd to hear the findings from our Q1 Internet Security Report! Learn more about the top threats detected in the first quarter and how you can defend your business against them!

Dustin StanleyEntrepreneurAuthor Commented:
Hello There
First, all NICs must support WOL.
They do.

Second, you cannot do it via Task Scheduler.
There is a option for On Startup.

Arnold
Are the distances among all the computers so vast or phrased better, I understand a dependency of all on the 1st computer that needs to be powered up first, what is the interdependency among the remaining?
This part I don't get 100%. The main PC controls a Backend of a Database and the computers are spread out.

Also I found this online but as I said I am very new to this area. Does this look legitimate and how would I execute it exactly???
param (\\[String\\]$MACAddrString = $(throw 'No MAC addressed passed, please pass as xx:xx:xx:xx:xx:xx'))
 $MACAddr = $macAddrString.split(':') | %\\{ \\[byte\\]('0x' + $_) \\}
 if ($MACAddr.Length -ne 6)
 \\{
     throw 'MAC address must be format xx:xx:xx:xx:xx:xx'
 \\}
 $UDPclient = new-Object System.Net.Sockets.UdpClient
 $UDPclient.Connect((\\[System.Net.IPAddress\\]::Broadcast),4000)
 $packet = \\[byte\\[\\]\\](,0xFF * 6)
 $packet += $MACAddr * 16
 \\[void\\] $UDPclient.Send($packet, $packet.Length)
 write "Wake-On-Lan magic packet sent to $MACAddrString, length $($packet.Length)"

Open in new window

0
arnoldCommented:
Appears to be powershell.

You can not run on boot per se, your execute has to wait until the network sets up or, the task will run firing packets that go nowhere.

The on boot task could be to schedule the transmission of the magic packets 10 minutes later as a single event presuming this shoukd be enough for the system's network to come up.

In your case you would read the MAC addresses from a file and loop through them sending packet.

Ms has a powershell cmdlet reference.

The following deals with the new-object call, https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.utility/new-object?view=powershell-5.1

It has to be tested against the version on your system, you mentioned Windows 7, the implementation might be different.
0
Hello ThereSystem AdministratorCommented:
I know there is such an option (if you would read my post properly you would notice that this function is a part of my suggestion). I am just talking about impossibility to use this on CLIENT machines in your situation. Thanks for understanding.
0
Dustin StanleyEntrepreneurAuthor Commented:
In the Powershell Function Script that Hello There provided in the link above it looks like this:
function Send-WOL
{
<# 
  .SYNOPSIS  
    Send a WOL packet to a broadcast address
  .PARAMETER mac
   The MAC address of the device that need to wake up
  .PARAMETER ip
   The IP address where the WOL packet will be sent to
  .EXAMPLE 
   Send-WOL -mac 00:11:32:21:2D:11 -ip 192.168.8.255 
#>

[CmdletBinding()]
param(
[Parameter(Mandatory=$True,Position=1)]
[string]$mac,
[string]$ip="255.255.255.255", 
[int]$port=9
)
$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) 

}

Open in new window


On that page it states for "Usage" to pass the argument or parameter like so:
Send-WOL -mac 00:11:32:21:2D:11 -ip 192.168.8.255 -port 7 
 
Send-WOL -mac 00-11-32-21-2D-11 -ip 192.168.8.255 -port 7 
 
Send-WOL -mac 0011.3221.2D11 -ip 192.168.8.255 -port 7 
 
Send-WOL -mac 001132212D11 -ip 192.168.8.255 -port 7 
 
Send-WOL -mac 001132212D11 

Open in new window



But how do I exactly pass this to the Powershell Function? I am very new to this area. I mainly work in VBA for Access. Do I set up a batch file to run with the argument in it or what?

Thank you all for the help.
0
Hello ThereSystem AdministratorCommented:
Save it as PS1 -> create a task and let it run.
0
Dustin StanleyEntrepreneurAuthor Commented:
I have been trying every which way with no luck from the Task Scheduler.  

In Arguments I have Tried:
-ExecutionPolicy Bypass "C:\Users\User 1\Downloads\Send-WOL.ps1" Send-WOL -mac 000000000000
-ExecutionPolicy Bypass "C:\Users\User 1\Downloads\Send-WOL.ps1" Send-WOL -mac 00:00:00:00:00:00 -ip 00.0.0.000 -port 7
-ExecutionPolicy Bypass "C:\Users\User 1\Downloads\Send-WOL.ps1" Send-WOL -mac 00:00:00:00:00:00 -ip 00.0.0.000
-ExecutionPolicy Bypass C:\Users\User 1\Downloads\Send-WOL.ps1 Send-WOL -mac 00:00:00:00:00:00 -ip 00.0.0.000 -port 7
-ExecutionPolicy Bypass C:\Users\User 1\Downloads\Send-WOL.ps1 Send-WOL -mac 00:00:00:00:00:00 -ip 00.0.0.000
-ExecutionPolicy Bypass Send-WOL.ps1 Send-WOL -mac 00:00:00:00:00:00

Open in new window


I have tried Start in:
C:\Users\User 1\Downloads\
"C:\Users\User 1\Downloads\"

Open in new window


No luck. With user logged in or with user logged in/out. Highest Privileges....
0
arnoldCommented:
you modify the example for a WOL on request
to a loop that reads MAC addresses of your systems in a file, and then issues a WOL to each system.
0
arnoldCommented:
Create a single file, computers_to_wakeup.txt
00:11:32:21:2D:11
.
.
.


Never use an IP since it will not be valid when the system is off, the 255.255.255.255 is a broadcast address which is what the WOL packet is destined for the MAC address of the NIC....

https://social.technet.microsoft.com/Forums/windows/en-US/78d5a5fa-bb82-4c2d-a2c1-96d518b9bd74/need-to-read-text-file-as-an-array-and-get-elements-from-each-line-of-array-using-powershell?forum=winserverpowershell

A way to read a csv file if you want to include
systemname,MAC address
and have the output reflect issued WOL to systemname Mac address: ...

the data extracted from the file is the loop surrounding the example.

first test the script manually before trying to scheduling it.
i.e. make sure it works, before proceeding to the next step.
Boot the system that is first. then run this script and see if the other system boot.

Many systems have BIOS start options.
You could schedule the boot every morning of the first at 8am as an example, while scheduling the others to boot 10 minutes later.
0
Dustin StanleyEntrepreneurAuthor Commented:
The code designers remarks are "default UDP port is 9". According to http://canyouseeme.org/ my port 9 is not seen. Do I have to open this port in my router to be able to WOL within my network?  If I do have to open and forward this port then how would I do this on multiple PCs if the single 9 port is forwarded to the 1 PC? Thank you for the help but so far not going so well.
0
arnoldCommented:
No, it is a broadcast packet addressed to a Mac address, each NIC will identify the packet addressed to it as long as the NIC is powered.

Forwarding etc. applies when the Windows OS is operational and analyzes the network packets passed by the Nic to the kernel network handler.

In this situation the Windows OS is off. The magic packet triggers the NIC to trigger the MB to start the bootup process.
0
Dustin StanleyEntrepreneurAuthor Commented:
On PC1 is there anywhere I would need to enable something to be able to SEND the magic packets. Like how I had to enable WOL by Magic Packets?

Also here is my system setup currently. I don't know if this will help you any.
Untitled.png
0
arnoldCommented:
no, all you need is the powershell script and the MAC address of the other devices to which you want the packet sent.

In the way you have it, if pc1 and pc2 are on different segments, than you will run into an issue, the magic packet can not cross segment boundaries so if PC1 is on 192.168.0.x/24 and PC2 is on 192.168.2.y/24 you will not be able to wake it up.

The only way would if your gateway supports it, to send the magic packet from the gateway.
0
Dustin StanleyEntrepreneurAuthor Commented:
Arnold
so if PC1 is on 192.168.0.x/24 and PC2 is on 192.168.2.y/24
Maybe I'm misunderstanding but both PCs have completely different IP address (IPv4 Address) such as:
PC1 = 10.1.0.125
PC2 = 10.1.0.724

Also the gateway and the first switch are basically just a router from the Service provider.

I just want to clarify this before I start thinking a different path. I thank you for the help.
0
arnoldCommented:
If they are on the same segment, they will see the broadcast which is what a magic packet is.
a.b.c.d is the normal format of the IPv4 IP.
a.b.c.x and a.b.c.y are IPs on the same segment when the network mask is 255.255.255.0

a.b.c.x and a.b.g.y are systems on different IP segments when both have the same 255.255.255.0 network mask.
the first a magic packet sent from a.b.c.x to the MAC address (ipconfig /all  look at the physical address entry for the local area connection or however you named it on the system you wish to awaken/start)

The second example, because they are on two different segments, the router is the only place from which this packet can be sent to be seen by a system on either network.

I'm still thinking it would be simpler to schedule the systems to boot using the BIOS though if there are days that you do not operate, those systems will be running.

The bootup/shutdown process is greater wear and tear on a system as compared to having it running all the time.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Dustin StanleyEntrepreneurAuthor Commented:
Thanks for the help. i am just going to set back up the scheduled power on at a certain time.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Networking Hardware-Other

From novice to tech pro — start learning today.