VMware Communities
jlemieux
Contributor
Contributor

Resume script never runs + Power change events on resume

NOTE: This is a repost since no one has been able to answer so far. Thanks.

-


I am really puzzled by these two issues.

1) Scripts

I created a custom script "C:\Scripts\resume_vm.bat" to be executed

when my VM resumes. The command "VMwareToolboxCmd.exe script resume

current" tells me that this script "C:\Scripts\resume_vm.bat" is indeed

really enabled. The first thing that this script does is "echo" of a

message in a log file. It turns out that the log file is never created,

thus the script is never executed when the VM resumes. In the guest

VMWare Tools graphical user interface, I can successfully "Execute Now"

this script and it works just fine.

What pushed me to modify the resume script is the fact that I have to

manually reset my network card in the VM after resuming, else all

network operations fail. It makes me suspect that even the standard

resume script is never executed.

Any clue on what might be happening here?

2) Power State Changes

I wrote the little C# program below. It helped me to discover that

Windows 7 "knows" that a suspend/resume operation is happening when I

use the standard Windows suspend command ("Start button" | "Suspend").

However, if the VM is suspended through a VM command ("VM | Power |

Suspend Guest" or "VM | Power | Suspend"), Windows is not aware

of the fact that the VM has suspended and resumed. This certainly

explains why my network drives are unusable after a resume that follows

a suspend initiated with a VMWare command.

Is this behavior "normal"? Does it mean that we should always suspend a

VM through the standard Windows command and never through VMware

commands? If so, why does VMWare offers these suspend commands?

Many thanks!

JL

-


using System;

using System.Text;

using System.Threading;

namespace ConsoleApplication1

{

class X

{

void SystemEvents_PowerModeChanged(object sender, Microsoft.Win32.PowerModeChangedEventArgs e)

{

Console.WriteLine("Power Event at " + DateTime.Now + " = " + e.Mode);

}

public void run()

{

Microsoft.Win32.SystemEvents.PowerModeChanged += new

Microsoft.Win32.PowerModeChangedEventHandler(SystemEvents_PowerModeChanged);

while (true)

Thread.Sleep(1000);

}

}

class Program

{

static void Main(string[] args)

{

new X().run();

}

}

}

0 Kudos
0 Replies