UtilProcessSetProcessPrivileges(String, Process, ProcessPrivileges, PrivilegeStates) Method

Enable or disable a process privilege for the specified process on the target computer.

Note that this method cannot add or remove privileges for external processes. It can only enable existing privileges that are currently disabled, or disable existing privileges that are currently enabled.

Trying to enable or disable a removed privilege will result in a exception.

In order to avoid this exception, it is recommended to call GetProcessPrivilegeState(Process, ProcessPrivileges) to determine whether a privilege is removed before calling this method.

Definition

Namespace: DevCase.Core.Diagnostics.Processes
Assembly: DevCase.net48 (in DevCase.net48.dll) Version: 6.0.0.0 (6.0)
XMLNS for XAML: Not mapped to an xmlns.
public static void SetProcessPrivileges(
	string computer,
	Process pr,
	ProcessPrivileges privileges,
	PrivilegeStates newPrivilegeState
)

Parameters

computer  String
The computer on which to set the privileges for the process.

If this value is empty, it sets the privileges for the current computer.

pr  Process
The process.
privileges  ProcessPrivileges
One or more privileges to set.
newPrivilegeState  PrivilegeStates
The new state for the privileges.

See Also