Share via


IVMVirtualMachine::AttachScriptToEvent method

The AttachScriptToEvent method specifies a script to run when an event occurs.

Syntax

HRESULT AttachScriptToEvent(
  [in] VMEventType eventType,
  [in] BSTR        scriptCommandLine
);

Parameters

eventType [in]

The event type.

scriptCommandLine [in]

Command line that will be executed when the specified event occurs.

Return value

This method can return one of these values.

This method supports standard return values, as well as the following. For information on Virtual Server specific return values not listed below, see HRESULT Codes Specific to the Virtual Server.

Return code Description
S_OK
The operation was successful.
E_INVALIDARG
The scriptCommandLine parameter is NULL or empty, or eventType is invalid.
VM_E_VM_UNKNOWN
The configuration is unknown.
VM_E_SCRIPT_ALREADY_ATTACHED_TO_EVENT
A script is already attached to this event.
DISP_E_EXCEPTION
An unexpected error has occurred.

Remarks

Scripts attached to an event will be launched automatically by Virtual Server when the event occurs.

Requirements

Product
Microsoft Virtual Server 2005 onWindows Server 2003
Download
Microsoft Virtual Server 2005 R2 SP1 Update onWindows Server 2008orWindows Server 2003
Header
VsComInterfaces.h

See also

IVMVirtualMachine

VMEventType