This is a static archive of our old Q&A Site. Please post any new questions and answers at ask.wireshark.org.

Start Vm via Powershell if Magic Packet (WOL) for this VM

0

Hi,

I try to find a option to start a VM via WOL.

MY Problem: I use hyper-v on a Windows Server 2012R2. Hyper-v dose not support WOL for VM's.

What I want to do: I want to send a magic package to wakeup one of the VM's. (If wol for Vm1 stat VM1; if Wil fir VM2 start VM2) I would need also something like a transfer table to translate the Mac address to the VM's name, so that I can use the Name of the VM in a Powershel script for the start. It have to work as a service because there will be no user.

I have read completely different things (t-shark;dumpcap;....)

Howe to implement something like this.

Got anybodya idea what's the " easiest" way to do this ?

Regards Michael

asked 15 Mar '16, 11:46

Micha82's gravatar image

Micha82
6113
accept rate: 0%

edited 16 Mar '16, 02:39

grahamb's gravatar image

grahamb ♦
19.8k330206


One Answer:

0

I'd go to a site like Stackoverflow with such question, Wireshark is all about packet analysis, not generation. I.e. Wireshark would show you how the magic packet should look like if you wouldn't know it, but cannot help you to send it.

answered 15 Mar '16, 11:57

sindy's gravatar image

sindy
6.0k4851
accept rate: 24%

Hi sindy,

Howe to send the magic package is not the problem.

My Problem is that I have to analyze all magic packages in the network and if one of the "right " packages comes by I want to start a specific script

(for each specified magic package a other script or maby the same but then I have to transfer the corosponding VM name as a variable to it )

(15 Mar '16, 12:24) Micha82

OK, so I've completely misunderstood your issue.

The problem with tshark is that it will get out of memory sooner or later (it would probably take years in your case, but it would happen), and the problem with dumpcap is that it can only save the captured packets to file or send them via pipe but not to analyse them (which prevents it from eating memory).

So your script would have to run two instances of tshark with a narrow capture filter like udp and (dst port 7 or dst port 9) in parallel, restarting them at different times so that at least one of them would always be running while the other one would be restarted. The output of the tshark instances piped to an executive script would either be the MAC (using -T fields -o wol.mac), or, if you feel dizzy, you could create a Lua post-dissector creating a new field vm_name and let Lua do the MAC -> VM name translation (so you would use -T fields -o wol.vm_name). You cannot ask Lua to spawn an external command.

(15 Mar '16, 13:49) sindy