Click here to Skip to main content
15,843,727 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I need clear working explanation

I tried the below to shutdown host machine and it works

system('shutdown /p' ); // for host
system('shutdown -s -m\\' ); // for vm
i need to shutdown installed vm's.. virtual machine are connected to our LAN network using VMWARE bridge.


1 solution

I can't tell if you are saying the shutdown works or not, but since you are asking about waking them up...

The way you wake up a machine is by sending a "magic packet" out on the network. This magic packet is sent to the broadcast address and the data it contains is 6 bytes of 0xFF and 16 repetitions of the MAC address of the machine you want to wake up.

Here is a reference on PHP sockets: PHP Sockets[^]

Here is data on the Wake On LAN Magic Packet[^].

However, reading through the VMWare documentation, it seems that the virtual machine can only be resumed using WOL if the machine is in the S1 sleep mode only. Powered off or hibernated machines cannot be resumed.

Another alternative is to make a script, place it on the remote vmware server and run that when you want to start the machine up. You will probably need powershell for this and permissions to execute scripts on the remote machine.

Out of curiosity, why PHP for this? Seems like something better suited to powershell scripting directly, unless you are trying to do this through a web interface?
Share this answer
sivamzcet 4-Jan-14 9:35am    
we need php script
Richard MacCutchan 4-Jan-14 11:00am    
Why are you continually reposting this same question? You are getting close to being kicked off this site for abuse.
Richard MacCutchan 4-Jan-14 11:01am    
Already answered at
and OP is pushing his luck.
sivamzcet 4-Jan-14 11:05am    
for shutdown server its okay. but we need to shutdown client using system('shutdown -m -s \\vmname -t 0') but its not work. What mistake in this function. Tell me if you know
Richard MacCutchan 4-Jan-14 11:10am    
You cannot shutdown a client from PHP.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900