TaskPrincipal Class

Provides the security credentials for a principal. These security credentials define the security context for the tasks that are associated with the principal.

Definition

Namespace: Microsoft.Win32.TaskScheduler
Assembly: Microsoft.Win32.TaskScheduler (in Microsoft.Win32.TaskScheduler.dll) Version: 2.11.1
[XmlRootAttribute("Principals", Namespace = "http://schemas.microsoft.com/windows/2004/02/mit/task", 
	IsNullable = true)]
public sealed class TaskPrincipal : IDisposable, 
	IXmlSerializable, INotifyPropertyChanged
Inheritance
Object    TaskPrincipal
Implements
INotifyPropertyChanged, IDisposable, IXmlSerializable

Remarks

This class can only be accessed via Principal. It is used to set properties related to the principal (account) that will run a task.

Example

C#
TaskDefinition td = TaskService.Instance.NewTask();
            td.Principal.UserId = "SYSTEM";
            td.Principal.LogonType = TaskLogonType.ServiceAccount;

Properties

Account Gets the account associated with this principal. This value is pulled from the TaskDefinition's XMLText property if set.
DisplayNameGets or sets the name of the principal that is displayed in the Task Scheduler UI.
GroupId Gets or sets the identifier of the user group that is required to run the tasks that are associated with the principal. Setting this property to something other than a null or empty string, will set the UserId property to NULL and will set the LogonType property to TaskLogonType.Group;
IdGets or sets the identifier of the principal.
LogonTypeGets or sets the security logon method that is required to run the tasks that are associated with the principal.
ProcessTokenSidTypeGets or sets the task process security identifier (SID) type.
RequiredPrivileges Gets the security credentials for a principal. These security credentials define the security context for the tasks that are associated with the principal.
RunLevel Gets or sets the identifier that is used to specify the privilege level that is required to run the tasks that are associated with the principal.
UserId Gets or sets the user identifier that is required to run the tasks that are associated with the principal. Setting this property to something other than a null or empty string, will set the GroupId property to NULL;

Methods

DisposeReleases all resources used by this class.
EqualsDetermines whether the specified object is equal to the current object.
(Inherited from Object)
FinalizeAllows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object)
GetHashCodeServes as the default hash function.
(Inherited from Object)
GetTypeGets the Type of the current instance.
(Inherited from Object)
MemberwiseCloneCreates a shallow copy of the current Object.
(Inherited from Object)
RequiresPasswordGets a value indicating whether current Principal settings require a password to be provided.
ToStringReturns a String that represents this instance.
(Overrides ObjectToString)
ValidateAccountForSidTypeValidates the supplied account against the supplied TaskProcessTokenSidType.

Events

PropertyChangedOccurs when a property value changes.

See Also