2.5.3.8 SessionStateChangeTrigger

If present, this trigger specifies that the task can start when one of the following system changes occurs.<25>

 <!-- SessionStateChangeTrigger -->
 <xs:simpleType name="sessionStateChangeType">
   <xs:restriction base="xs:string">
     <xs:enumeration value="ConsoleConnect"/>
     <xs:enumeration value="ConsoleDisconnect"/>
     <xs:enumeration value="RemoteConnect"/>
     <xs:enumeration value="RemoteDisconnect"/>
     <xs:enumeration value="SessionLock"/>
     <xs:enumeration value="SessionUnlock"/>
   </xs:restriction>
 </xs:simpleType>
 <xs:complexType name="sessionStateChangeTriggerType">
   <xs:complexContent>
     <xs:extension base="triggerBaseType">
       <xs:sequence>
         <xs:element name="UserId" type="nonEmptyString" 
         minOccurs="0"/>
         <xs:element name="Delay" type="xs:duration" default="PT0M" 
         minOccurs="0"/>
         <xs:element name="StateChange" 
         type="sessionStateChangeType"/>
       </xs:sequence>
     </xs:extension>
   </xs:complexContent>
 </xs:complexType>

UserId: If present, this field MUST contain an account name. The server fires the trigger when that user has a session change as specified by the StateChange field. The task starts in the context (identity) specified by the Principal part as specified in section 2.5.6. Only one UserId is to be specified in the SessionStateChangeTrigger.

Delay: If present, this field MUST contain a user-specified delay value as specified for "time duration" in section 2.5.1.1. The task can have a delayed start until after the trigger has fired for the session state change. The time duration of the delayed start is equal to the delay value.

StateChange: This field is present and specifies one of the following strings.

String

Behavior

ConsoleConnect

Specifies that the task is started when a user connects to a new session from a local computer while keeping an old session active.<26>

ConsoleDisconnect

Specifies that the task is started when a user disconnects from a new session on a local computer, and the new session was established while keeping an old session active.

RemoteConnect

Specifies that the task is started when a user connects to a remote session.

RemoteDisconnect

Specifies that the task is started when a user disconnects from a remote session.

SessionLock

Specifies that the task is started when user locks the workstation.

SessionUnlock

Specifies that the task is started when user unlocks the workstation.