A Powershell 3.0+ script to send Wake-On-LAN packets to multiple hosts.
Select target PCs from source files passed as parameters, from Organization Units, or from manual entry. Resolves target MAC addresses from data files generated by macscanner.sh. Sends 3x WoL broadcasts for each host.
Organizational Unit graphical selection dialog provided by MicaH's Choose-ADOrganizationaUnit function. https://itmicah.wordpress.com/2016/03/29/active-directory-ou-picker-revisited/
How it works
- If working with multiple subnets, select the site/subnet the wake targets are in.
- Hosts are provided by input files, OU selection, or manual entry.
- Host MAC addresses are retrieved from data files built from Nmap parsing (macscanner.sh).
- Enter PS Remote session to Windows host on the target subnet, and pass hostnames and MAC addresses.
- Create "magic" WoL UDP packets with .NET functions for each host and broadcast from remote host.
- Powershell Remoting enabled on remote host. To establish a PS Remote session, at least one of the following must be true:
- The local PC must be on the same domain as the remote PC.
- The remote host must have the local PC in its trusted hosts.
- You must configure the remote and local PCs to do PS Remoting over HTTPS.
- Powershell 3.0+ on both the local and remote PCs.
- ActiveDirectory Powershell module installed on the local PC (available in Windows RSAT).
- MicaH's ChooseADOrganizationalUnit.ps1 file for dotsourcing. https://itmicah.wordpress.com/2016/03/29/active-directory-ou-picker-revisited/
- Pass a list of hosts from a text file by calling
Wake-Send.ps1with no parameters to enter interactive mode.
- If waking hosts from AD OU, select the OU from the graphical dialog.
- Else, enter hostnames or IPs one by one.
Read through script comments for the lines that must be edited to suit your environment.