Does anyone know if there is a way to run a script to wake a machine via WOL before the patch scan/install runs?
I can create a script that will use something like rw.exe to send a magic packet to a machine, but I need to know the MAC address, so I need some variable or something that takes the MAC address of the machine about to be scanned and uses that, rather than having to hard code the MAC in to the script.
Alternatively is there a way to send a WOL magic packet to all machines on the network via a script first?
My workaround for this issue was somewhat convoluted but worked fine.
First, I created a report that simply shows the mac addresses of each agent.
I then went and found the HTML file that gets generated when this report runs. Scheduled reports always dump an HTML version to the same directory and filename on the Kaseya server.
I then put a script in the kaseya server to copy this html file to the managed files folder.
Last but not least, I wrote a script that dumps the html file, then runs a rw.exe against all mac addresses in the HTML file. Granted there can be a huge number of mac addresses. However, rw runs so fast it's not a big problem.
The secret, however, to the mac address trick was the for command in windows. Use the for command to remove the hyphens from the mac addresses, as well as the other crap that will be in that html file. I personally didn't bother cleaning up the lines in the HTML file that don't have MAC addresses. Instead, I just let those lines run. They don't hurt.
As for the magic in the for command, I would suggest you take some time to go and have a play. something along the lines of this should work:
for /f "delims=- tokens=1,2,3,4,5,6,7,8" %a in (textfile.txt) do rw.exe %a%b%c%d%e%f%g%h
This for command will take 00-00-00-00-00-00-00-00 and run rw.exe 0000000000000000, just to give you an example. You might need to do another couple of delims to get the pre-mac address part of the line out the way, add another token or two to accomodate for this, and then do rw.exe %c%d etc.
Standard For Command Disclaimer: This may all sound cryptic but I suggest you get your head around the for command. It is one of the best tools in windows, and can really help make your K scripts dominate the ghetto.