Script for Remote Wake on Lan
We use a product for managed services called Kaseya and I can run custom
scripts for almost any task I need, well if I were better at scripting I
could :-). My situation is I need to be able to run a script that will
execute the wol.exe /m:MacAddress. The script would be executed from a server
inside the lan. The mac address is stored in kaseya which i can grab using a
variable #vMachine.MacAddr#. Unfortunately the way it is formatted
"00-00-00-00-00" means i need to strip out the "-" before executing the
script. I will need to replace the variable with the actual mac address
before execution. I hope someone can help me or lead me in the right
direction. Thanks in advance for your help.
Re: Script for Remote Wake on Lan
"Wayne Jordan" <Wayne Jordan@discussions.microsoft.com> wrote in message
news:83BDAE2D-4619-499A-B101-DD42B69F8E28@microsoft.com...
> We use a product for managed services called Kaseya and I can run custom
> scripts for almost any task I need, well if I were better at scripting I
> could :-). My situation is I need to be able to run a script that will
> execute the wol.exe /m:MacAddress. The script would be executed from a
> server
> inside the lan. The mac address is stored in kaseya which i can grab using
> a
> variable #vMachine.MacAddr#. Unfortunately the way it is formatted
> "00-00-00-00-00" means i need to strip out the "-" before executing the
> script. I will need to replace the variable with the actual mac address
> before execution. I hope someone can help me or lead me in the right
> direction. Thanks in advance for your help.
I'm a little unclear about the process flow. Does it go like so?
1. You're in Kaseya.
2. You click the WakeUp button.
3. Kaseya calls ??? with a parameter of 0a-bc-11-34-06-bb (for example).
4. Your script turn this address into 0abc113406bb.
5. Your script invokes this command: wol.exe /m:0abc113406bb.
What is the ??? bit?
Re: Script for Remote Wake on Lan
> I'm a little unclear about the process flow. Does it go like so?
> 1. You're in Kaseya.
Yes, Kaseya is similar to Altiris or SMS. All managed workstations have
agents on them and kaseya collects that data and puts it into a sql database.
> 2. You click the WakeUp button.
This would be the Script I write. I would select each machine i want to wake
up and kaseya would execute that script from a local server in the lan
> 3. Kaseya calls ??? with a parameter of 0a-bc-11-34-06-bb (for example).
based on which machine i click on i can grab the #vMachine.MacAddr# which is
the mac address stored in the sql database for that machine
> 4. Your script turn this address into 0abc113406bb.
Yes.
> 5. Your script invokes this command: wol.exe /m:0abc113406bb.
Yes, kaseya would execute this as a shell command on the server. The only
thing that would be better if i could find a wake on lan that wouldn't care
about the format of the mac address :-).
>
> What is the ??? bit?
kaseya would execute this as if one machine at a time so i would be able to
use the variable from the machine id to capture the #vMachineMacAddr#.
Hope this helps clarify, Thanks
Re: Script for Remote Wake on Lan
Unfortunately your answer did not really tell me anything
about the ??? bit, so I will assume that ??? can be a batch
file of your own choice with the MAC-address being its
parameter. If so then the simplest solution would go like so:
@echo off
set mac=%1
echo wol.exe /m:%mac:-=%
"Wayne Jordan" <WayneJordan@discussions.microsoft.com> wrote in message
news:57C4DFEC-FEC3-43F8-8C13-676D3F00CFE2@microsoft.com...
>> I'm a little unclear about the process flow. Does it go like so?
>> 1. You're in Kaseya.
>
> Yes, Kaseya is similar to Altiris or SMS. All managed workstations have
> agents on them and kaseya collects that data and puts it into a sql
> database.
>
>> 2. You click the WakeUp button.
>
> This would be the Script I write. I would select each machine i want to
> wake
> up and kaseya would execute that script from a local server in the lan
>
>> 3. Kaseya calls ??? with a parameter of 0a-bc-11-34-06-bb (for example).
>
> based on which machine i click on i can grab the #vMachine.MacAddr# which
> is
> the mac address stored in the sql database for that machine
>
>> 4. Your script turn this address into 0abc113406bb.
>
> Yes.
>
>> 5. Your script invokes this command: wol.exe /m:0abc113406bb.
>
> Yes, kaseya would execute this as a shell command on the server. The only
> thing that would be better if i could find a wake on lan that wouldn't
> care
> about the format of the mac address :-).
>
>>
>> What is the ??? bit?
>
> kaseya would execute this as if one machine at a time so i would be able
> to
> use the variable from the machine id to capture the #vMachineMacAddr#.
>
> Hope this helps clarify, Thanks
>
Re: Script for Remote Wake on Lan
Just do:
NewMac = replace(OldMac, "-", "")
That will remove the dashes.
Also, instead of using a command-line utility to do Wake On LAN,
consider using this free, scriptable component I found a while ago:
http://www.depicus.com/wake-on-lan/wake-on-lan-com.aspx
Hope this helps.
----------------
Trevor Sullivan
Systems Engineer
Wayne Jordan wrote:
> We use a product for managed services called Kaseya and I can run custom
> scripts for almost any task I need, well if I were better at scripting I
> could :-). My situation is I need to be able to run a script that will
> execute the wol.exe /m:MacAddress. The script would be executed from a server
> inside the lan. The mac address is stored in kaseya which i can grab using a
> variable #vMachine.MacAddr#. Unfortunately the way it is formatted
> "00-00-00-00-00" means i need to strip out the "-" before executing the
> script. I will need to replace the variable with the actual mac address
> before execution. I hope someone can help me or lead me in the right
> direction. Thanks in advance for your help.