Working on another project and I needed a way to wake up an offline server from within my PS script. I found this genius blog post and converted it to a script.
Genius blog post - The PowerShell Guy : PowerShell Wake-on-lan script
I saved the below text as send-wol.ps1 for re-usability. This code came from The PowerShell Guy blog, I cannot claim credit!!!! I just made it a script. Mainly, I combined two snippets from his post and added the args reference.
So how would you run it? I would proactively open a command prompt and get the mac addresses from your arp table and save them to a file. You can get at the table by running “arp –a” and locating the IP address for the node you are concerned about. Later if you want to wake the host up, just open PowerShell, and run the script as follows:
Other ways to get the arp address for an offline machine? If your network devices have SNMP enabled you may be able to leverage vendor tools to retrieve arp data from there. If you have an inventory too such as System Center Configuration Manager, it would also store that data.