UserLock API
Classes | Public Member Functions | Static Public Member Functions | Properties | List of all members
UserLockServer Class Reference

Instance of a local or remote UserLock server More...

Inherits IDisposable, IDisposable, and IDisposable.

Classes

interface  IOperationNotify
 Interface for callback classes used in ExecuteOperation. More...
 
interface  IOperationParams
 Interface base to operation params in ExecuteOperation method. More...
 
class  SendPopupParams
 Parameters to send popup operation. More...
 
class  ShutdownParams
 Parameters to shutdown operation. More...
 
class  Statistic
 Represents a statistic element. More...
 
class  TaskAsync
 Represents an asynchornous task element. More...
 
class  TaskAsyncResult
 Represents an asynchronous task result. More...
 

Public Member Functions

 UserLockServer (string serverName)
 Create an instance of UserLockServer by providing the address of the UserLock server More...
 
 UserLockServer ()
 Create an instance of UserLockServer connected to the local UserLock service. More...
 
string GetConnectionString ()
 Gets the connection string to the database used by the UserLock server. More...
 
int TestUserLockSession (string userName, string computerName, string clientName, string clientIps, SessionType sessionType, DateTime dateTime, out bool isAllowed, out string ulSrvAnswer)
 Tests if a new UserLock session would be allowed or denied. More...
 
string TestUserLockSession (string userName)
 Tests if a new UserLock session would be allowed or denied. More...
 
bool CheckAdminCredentials (string account, string domain, string password)
 Check if the credentials for an admin account are valid More...
 
void Refresh ()
 Refresh specific UserLock data. More...
 
void Refresh (ServerDataElement elements)
 Refresh all UserLock data. More...
 
void Reconnect ()
 Reconnect to the UserLock server. More...
 
string GetEnforceSync ()
 Enforce synchronization with the primary server. This command can only be sent to a backup server. More...
 
string GetEnforceSessionSync ()
 Enforce session synchronization with the primary server. This command can only be sent to a backup server. More...
 
List< ReportedUserGetOrphanedUsers ()
 Get all orphaned users. More...
 
bool ResetMFAKey (string UserName)
 Resets the MFA key for the provided user account name. More...
 
void DisableMFA (string accountName, DateTime startDate, DateTime endDate)
 Disable MFA for the provided account name. More...
 
void DisableMFAAndResetMFAHelpMeStatus (string accountName, DateTime startDate, DateTime endDate)
 Disable MFA and reset the MFA help me status for the provided account name. More...
 
TaskAsync RestartServiceAsync (string serviceName, string computerName=".")
 Restart service on computer More...
 
bool CanTestMfaUrl ()
 Checks if the MFA IIS URL is relative or not. More...
 
bool TestMfaUrl (out string errorMessage, string publicUrl="", string privateUrl="")
 Tests the MFA URL. More...
 
IList< EnabledPolicies > GetEnabledPolicies ()
 Retrive a list of all enabled policies on the server. More...
 

Static Public Member Functions

static void UrlDecode (ref String sToDecode)
 URL decode the parameter string according to the HTML URL Encoding Reference (https://www.w3schools.com/TAGS/ref_urlencode.asp). More...
 
static void UrlEncode (ref String s, bool bEncodeSlash=true, bool bEncodeComma=false, bool bEncodePr100=true, bool bEncodeColon=true, bool bEncodeBackS=true, bool bEncodeAster=true, bool bEncodeSemiC=true, bool bEncodeParLe=true, bool bEncodeParRi=true, bool bEncodeNewLi=true)
 URL encode the parameter string according to the HTML URL Encoding Reference (https://www.w3schools.com/TAGS/ref_urlencode.asp). More...
 
static string CombineUrl (string baseUrl, string pathToAdd)
  More...
 

Properties

ClientServerCompatibility ServerCompatibility [get, set]
 Compatibility between the client and the server. More...
 
Version ClientCommandSetVersion [get]
 The version of the command set of the client. More...
 
Version ServerCommandSetVersion [get, set]
 The version of the command set of the server. More...
 
string UserName [get, set]
 The username. More...
 
string DomainName [get, set]
 The domain name. More...
 
string Password [get, set]
 The password. More...
 
Exception ConnectionException [get]
 Get the last exception generated by the client/server communication. See the example in the constructor of the class UserLockServer. More...
 
string ConnectionStringWithoutPassword [get]
 Get the connection string to the database used by the UserLock server for the logon history. More...
 
ServerProperties Properties [get]
 Get the server properties. See the ServerProperties class for more information. More...
 
MinMaxSessionCounts MinMaxSessionCounts [get]
 The min and max session counts. More...
 
LicenseStatus LicenseStatus [get]
 Get the license status for the UserLock server. See the enum LicenseStatus for all possible values. More...
 
LicenseUseStatus LicenseUseStatus [get]
 Use of the license. See the LicenseUseStatus enum for all possible values. More...
 
bool IsSmtpConfigured [get]
 true if E-mail settings for notifications are configured, false otherwise. More...
 
bool AdminCredentialsStatus [get]
 true if the credentials of the impersonation account are valid, false otherwise. More...
 
ProtectedAccounts ProtectedAccounts [get]
 Get the list of all protected accounts configured on the UserLock server. More...
 
Messages Messages [get]
 Get the list of all customizable message from the UserLock server More...
 
ReportedUserSessions UserSessions [get]
 Interactive user sessions. More...
 
ReportedUserSessions AllUserSessions [get]
 All user sessions. More...
 
ReportedUserSessions UserSessionsWithSessionOnly [get]
 Users with sessions. More...
 
ReportedUserSessions UserSessionsActiveSessionsOnly [get]
 Active user sessions (not locked and not disconnected). More...
 
ReportedUserSessions UserSessionsWithMoreOneSessionOnly [get]
 Users with more than one session. More...
 
ReportedUserSessions UserSessionsComputerUnavailableOnly [get]
 Users with orphaned sessions (sessions on unreachable computers). More...
 
ReportedUserSessions UserSessionsLockedSessionsOnly [get]
 Locked user sessions. More...
 
ReportedUserSessions UserSessionsWorkstationSessionsOnly [get]
 workstation user sessions. More...
 
ReportedUserSessions UserSessionsTerminalSessionsOnly [get]
 terminal user sessions. More...
 
ReportedUserSessions UserSessionsIisSessionsOnly [get]
 iis user sessions. More...
 
ReportedUserSessions UserSessionsVpnSessionsOnly [get]
 vpn user sessions. More...
 
ReportedUserSessions UserSessionsWifiSessionsOnly [get]
 wifi user sessions. More...
 
ReportedUserSessions UserSessionsSaasSessionsOnly [get]
 saas user sessions. More...
 
ReportedUserSessions UserSessionsWithActiveUser [get]
 user sessions with active user. More...
 
ReportedUserSessions UserSessionsWithProtectedUser [get]
 user sessions with protected user. More...
 
ReportedUserSessions UserSessionsWithUnprotectedUser [get]
 user sessions with unprotected user. More...
 
ReportedUserSessions UserSessionsWithHighRiskUser [get]
 user sessions with high risk user. More...
 
ReportedUserSessions UserSessionsWithRiskUser [get]
 user sessions with risk user. More...
 
ReportedUserSessions UserSessionsWithNewUser [get]
 user sessions with new user. More...
 
ReportedUserSessions UserSessionsWithInactiveUser [get]
 user sessions with inactive user. More...
 
ReportedUserSessions UserSessionsWithOneSessionOnly [get]
 user sessions with inactive user. More...
 
ReportedMachineSessions MachineSessions [get]
 All machine sessions. More...
 
ReportedMachineSessions MachineSessionsWithSessionOnly [get]
 Machines with sessions. More...
 
ReportedMachineSessions MachineSessionsActiveSessionsOnly [get]
 Active machine sessions (not locked and not disconnected). More...
 
ReportedMachineSessions MachineSessionsComputerUnavailableOnly [get]
 Machines with orphaned sessions (sessions on unreachable computers). More...
 
ReportedMachineSessions MachineSessionsWithMoreOneSessionOnly [get]
 Machines with more than one session. More...
 
ReportedMachineSessions MachineSessionsWithOneSessionOnly [get]
 Machines with only one session. More...
 
ReportedRasSessions RasUserSessions [get]
 Wi-Fi / VPN (RAS) user sessions. More...
 
List< ReportedMachineReportedMachinesSimpleEx [get]
 List of workstations with the number of sessions on each workstation, and optionally the username. User and session information is optionally provided. This is a public command. Anyone can get this information. More...
 
MachineStates AgentDistributionDCOnly [get]
 Agent status for all domain controllers in the protected network zone. More...
 
MachineStates AgentDistributionMacOnly [get]
 Agent status for all macOS computers in the protected network zone. More...
 
int TotalSessionCount [get]
 The total number of sessions. More...
 
int TotalUserCount [get]
 The total number of users. More...
 
int CurrentNumberLicencesConsumed [get]
 The current number of licenses consumed. More...
 
int NumberLicencesConsumedOneYearMax [get]
 The probable number of licenses that could be consumed after one year of use of the software if you only protect Interactive sessions (twice the number of Desktop UserLock agents installed). This number is not realistic if you are protecting IIS, Wi-Fi, or VPN sessions. More...
 
int NumberLicencesConsumedOneYearProbablyInteractive [get]
 The probable number of licenses that could be consumed after one year of use of the software if you only protect Interactive sessions (twice the number of Desktop UserLock agents installed). This number is not realistic if you are protecting IIS, Wi-Fi, or VPN sessions. More...
 
int MaxSessionCount [get]
 This property is obsolete. Use MaxNumberConsumableLicences instead. More...
 
int MaxNumberConsumableLicences [get]
 The maximum number of consumable licenses. More...
 
bool IsSubscription [get]
 The licensing mode, true if subscriptive. More...
 
bool IsByUser [get]
 The licensing mode, true if by users. More...
 
bool Connected [get]
 True if the instance of UserLockServer is connected to a UserLock server. False otherwise. More...
 

General properties

string ServerName [get, set]
 Get or set the address of the UserLock server. Specify a dot (.) for a local server. More...
 
string ServerAddress [get]
 Get the address of the UserLock server. A null value is returned for a local server More...
 
static string LocalMachineName [get]
 Get the name of the local machine the UserLock API is running on More...
 
string DisplayName [get]
 Get the display name (NetBIOS name) of the UserLock server. More...
 
string ServiceVersion [get]
 Get the version of the UserLock service. More...
 
string UserLockServerDomainName [get]
 Get the domain name (NetBIOS name) of the UserLock server. More...
 
System.Collections.Specialized.StringDictionary IllegitimateServerNames [get]
 The illegitimate server names. More...
 
ServerMode ServerType [get]
 Get the server type. See the enum ServerMode for more information. More...
 
string BackupServer [get]
 The name of the backup server, if any. More...
 
string _ServerName
 
bool IsServiceVersionWithTransaction ()
 

Session properties and functions

List< ReportedUserReportedUsers [get]
 List of users with the list of interactive sessions for each. See the class ReportedUser. More...
 
List< ReportedUserAllReportedUsers [get]
 List of users with the list of all kind of sessions for each. See the class ReportedUser. More...
 
List< ReportedUserReportedUsersWithMoreThanOneSession [get]
 List of users with more than one session. More...
 
List< ReportedUserActiveReportedUsers [get]
 List of users with an active status (protected + unprotected). See the enum UserStatus. More...
 
List< ReportedUserProtectedReportedUsers [get]
 List of users with an protected status. See the enum UserStatus. More...
 
List< ReportedUserUnprotectedReportedUsers [get]
 List of users with an unprotected status. See the enum UserStatus. More...
 
List< ReportedUserHighRiskReportedUsers [get]
 List of users with an high risk status. See the enum UserStatus. More...
 
List< ReportedUserRiskReportedUsers [get]
 List of users with a risk status. See the enum UserStatus. More...
 
List< ReportedUserNewReportedUsers [get]
 List of users with a new status. See the enum UserStatus. More...
 
List< ReportedUserInactiveReportedUsers [get]
 List of users with an inactive status. See the enum UserStatus. More...
 
List< ReportedUserReportedUsersWithOneSessionOnly [get]
 List of users with only one session. More...
 
List< SessionAllSessions [get]
 Get all sessions from any kind More...
 
List< InteractiveSessionInteractiveSessions [get]
 Get all interactive sessions. More...
 
List< RasSessionRasSessions [get]
 Get the list of Wi-Fi / VPN sessions. See the class RasSession. More...
 
List< IisSessionIisSessions [get]
 Get the list of IIS sessions. See the class IisSession. More...
 
List< ReportedMachineReportedMachines [get]
 Get the list of computers with the list of interactive sessions on each computer. See the class ReportedMachine. More...
 
List< ReportedMachineReportedMachinesSimple [get]
 List of workstations with only the number of sessions on each workstation. User and session information is not provided. This is a public command. Anyone can get this information. More...
 
ReportedUser GetReportedUser (string userName)
 Get interactive sessions for a specific user. See the class ReportedUser. More...
 
ReportedMachine GetReportedMachine (string machineName)
 Get interactive sessions on a specific computer. See the class ReportedMachine. More...
 

Quota management functions

TimeQuotaStatus GetUserQuotaStatus (string userAccount)
 Get the quota status for a user. See the documentation of the class TimeQuotaStatus More...
 
void DecreaseConsumedTime (string userAccount, SessionType sessionType, TimeQuota.Period period, int minutes)
 Decrease the time consumed by a user for a specific type of session and quota period. More...
 
void DecreaseConsumedTime (string userAccount, SessionType sessionType, TimeQuota.Period period, TimeSpan timeToDecrease)
 Decrease the time consumed by a user for a specific type of session and quota period. More...
 
void ResetConsumedTime (string userAccount)
 Reset the time consumed by a user to 0 for all types of session and all quota periods. More...
 
void ResetConsumedTime (string userAccount, SessionType sessionType, TimeQuota.Period period)
 Reset the time consumed by a user to 0 for a specific type of session and quota period. More...
 

Agent distribution

Machines MachineDistribution [get]
 Get the all machines with all agent inside of the protected network zone. More...
 
Machines MachineDistributionAll [get]
 Get all machines inside of the protected network zone. See the class Machines. More...
 
Machines MachineDistributionDCOnly [get]
 Get Domain Controller machines inside of the protected network zone. See the class Machines. More...
 
Machines MachineDistributionRRASOnly [get]
 Get RRAS machines inside of the protected network zone. See the class Machines. More...
 
Machines MachineDistributionNPSOnly [get]
 Get NPS machines inside of the protected network zone. See the class Machines. More...
 
Machines MachineDistributionIISOnly [get]
 Get IIS machines inside of the protected network zone. See the class Machines. More...
 
Machines MachineDistributionUnavailable [get]
 Get Unavailable machines inside of the protected network zone. See the class Machines. More...
 
Machines MachineDistributionWithoutAgent [get]
 Get machines without agent inside of the protected network zone. See the class Machines. More...
 
Machines MachineDistributionMACOnly [get]
 Get Mac machines inside of the protected network zone. See the class Machines. More...
 
Machines MachineDistributionWithAgent [get]
 Get machines with agent inside of the protected network zone. See the class Machines. More...
 
Machines MachineDistributionWorkstation [get]
 Get Workstation machines inside of the protected network zone. See the class Machines. More...
 
Machines MachineDistributionServer [get]
 Get Server machines inside of the protected network zone. See the class Machines. More...
 
Machines MachineDistributionDesktop [get]
 Get machines, inside of the protected network zone, where agent desktop can be installed. See the class Machines. More...
 
Machines MachineDistributionToUpdate [get]
 
HashSet< String > DeployedMachinesName [get]
 
MachineStates AgentDistribution [get]
 Get the agent status for all machines of the protected network zone. More...
 
MachineStates AgentDistributionWithoutAgent [get]
 Get the agent status for all machines of the protected network zone without the agent installed. More...
 
MachineStates AgentDistributionUnavailable [get]
 Get the agent status for all unavailable machines of the protected network zone. More...
 
AgentDistributionProperties AgentDistributionProperties [get]
 Get the agent distribution properties of the UserLock server. See the class AgentDistributionProperties for more information. More...
 
string CheckStatus (string computerName)
 
TaskAsync CheckStatusAsync (string computerName)
 
string CheckRequirements (string computerName)
 
TaskAsync CheckRequirementsAsync (string computerName)
 

Statistics

SessionStatisticMode SessionStatisticMode [get, set]
 Get set the session statistic mode. See the enum SessionStatisticMode. More...
 
Statistic[] SessionStatistics [get]
 Get session statistics (Session break down Orphaned/Locked Interactive/Active Interactive/RAS/IIS). See also the class Statistic. More...
 
Statistic[] UserStatistics [get]
 Get user statistics (0 session/1 session/More than 1 session). See also the class Statistic. More...
 
Statistic[] UserStatusStatistics [get]
 Get user status statistics (high risk/risk/new/inactive/protected/unprotected). See also the class Statistic. More...
 
Statistic[] MachineStatistics [get]
 Get machine statistics (0 session/1 session/> 1 session). See also the class Statistic. More...
 
Statistic[] AgentDistributionStatistics [get]
 Get agent statistic (Not Installed/Installed/Unknown/Installing/Uninstalling/Upgrading). See also the class Statistic. More...
 
Statistic[] AgentTypeStatistics [get]
 Agent type statistics (Desktop, DC, NPS, IIS, RRAS (deprecated)). See also the Statistic class. More...
 
Statistic[] MachineStateStatistics [get]
 Get ServerLevel statistic (DC/IAS/IIS/RRAS(deprecated)....). See also the class Statistic. More...
 
Statistic[] ProtectedAccountStatistics [get]
 Get Protected account statistic (OU / Groups / Users). See also the class Statistic. More...
 
HashSet< String > MfaNeedHelpUserList [get]
 Get the list of users needing help for mfa. More...
 
Statistic[] MachineEnvironmentStatistics [get]
 Get Machine Environment statistics. See also the class Statistic. More...
 
Statistic[] UserEnvironmentStatistics [get]
 Get User Environment statistics. See also the class Statistic. More...
 
Statistic[] MonitoringSessionsStatistics [get]
 Get monitoring sessions statistics. See also the class Statistic. More...
 
Statistic[] MonitoringUserSessionsStatistics [get]
 Get monitoring user sessions statistics. See also the class Statistic. More...
 
Statistic[] MonitoringMachineSessionsStatistics [get]
 Get monitoring machine sessions statistics. See also the class Statistic. More...
 

Protected account management functions

ProtectedAccount GetProtectedAccount (string identifier)
 Get a temporary protected account by its identifier. More...
 
ProtectedAccount GetProtectedAccount (string identifier, ProtectedAccountBase.AccountPropertyList propertyList)
 Get a protected account. More...
 
ProtectedAccount GetTemporaryProtectedAccount (string accountName, DateTime startDate, DateTime endDate)
 Gets the temporary protected account from the account name and start and end dates. More...
 
ProtectedAccountEffective GetProtectedAccountEffective (string accountName, ProtectedAccountBase.AccountPropertyList propertyList, ProtectedAccount.ComplexEffRestsPropertyList cersPropertyList)
 Get effective restrictions of a user (depending on the policy). More...
 
bool DoesProtectedAccountExist (string accountName)
 Check if a protected account exists. More...
 
bool AddProtectedGroup (string groupName, out ProtectedAccount paRet)
 Add a new protected group and return it if succeeded. More...
 
bool AddProtectedGroupWithTransact (string groupName, out ProtectedAccount paRet, bool transactAlreadyStarted)
 
bool AddProtectedGroup (string groupName)
 Add a new protected group. More...
 
bool AddProtectedGroupWithTransact (string groupName, bool transactAlreadyStarted)
 
bool AddProtectedUser (string userName, out ProtectedAccount paRet)
 Add a new protected user and return it if succeeded. More...
 
bool AddProtectedUserWithTransact (string userName, out ProtectedAccount paRet, bool transactAlreadyStarted)
 
bool AddProtectedUser (string userName)
 Add a new protected user. More...
 
bool AddProtectedUserWithTransact (string userName, bool transactAlreadyStarted)
 
bool AddProtectedOu (string ouDistinguishedName, out ProtectedAccount paRet)
 Add a new protected organizational unit and return it if succeeded. More...
 
bool AddProtectedOuWithTransact (string ouDistinguishedName, out ProtectedAccount paRet, bool transactAlreadyStarted)
 
bool AddProtectedOu (string ouDistinguishedName)
 Add a new protected organizational unit. More...
 
bool AddProtectedOuWithTransact (string ouDistinguishedName, bool transactAlreadyStarted)
 
bool AddProtectedAccount (string accountName, ProtectedAccountType pat)
 Add a protected account by its name and its type. More...
 
bool AddProtectedAccountWithTransact (string accountName, ProtectedAccountType pat, bool transactAlreadyStarted)
 
bool AddProtectedAccount (string accountName, ProtectedAccountType pat, string idPaToCopyCfgFrom)
 Add a protected account by its name, its type and another protected account to copy all configuration from. More...
 
bool AddProtectedAccountWithTransact (string accountName, ProtectedAccountType pat, string idPaToCopyCfgFrom, bool transactAlreadyStarted)
 
bool AddTemporaryProtectedUser (string accountName, DateTime startDate, DateTime endDate)
 Add a user temporary protected account by its name. More...
 
bool AddTemporaryProtectedUserWithTransact (string accountName, DateTime startDate, DateTime endDate, bool transactAlreadyStarted)
 
bool AddTemporaryProtectedGroup (string accountName, DateTime startDate, DateTime endDate)
 Add a group temporary protected account by its name. More...
 
bool AddTemporaryProtectedGroupWithTransact (string accountName, DateTime startDate, DateTime endDate, bool transactAlreadyStarted)
 
bool AddTemporaryProtectedOu (string accountName, DateTime startDate, DateTime endDate)
 Add a OU temporary protected account by its name. More...
 
bool AddTemporaryProtectedOuWithTransact (string accountName, DateTime startDate, DateTime endDate, bool transactAlreadyStarted)
 
bool AddTemporaryProtectedUser (string accountName, DateTime startDate, DateTime endDate, out ProtectedAccount paRet)
 Add a user temporary protected account by its name and return it if succeeded. More...
 
bool AddTemporaryProtectedUserWithTransact (string accountName, DateTime startDate, DateTime endDate, out ProtectedAccount paRet, bool transactAlreadyStarted)
 
bool AddTemporaryProtectedGroup (string accountName, DateTime startDate, DateTime endDate, out ProtectedAccount paRet)
 Add a group temporary protected account by its name and return it if succeeded. More...
 
bool AddTemporaryProtectedGroupWithTransact (string accountName, DateTime startDate, DateTime endDate, out ProtectedAccount paRet, bool transactAlreadyStarted)
 
bool AddTemporaryProtectedOu (string accountName, DateTime startDate, DateTime endDate, out ProtectedAccount paRet)
 Add a OU temporary protected account by its name and return it if succeeded. More...
 
bool AddTemporaryProtectedOuWithTransact (string accountName, DateTime startDate, DateTime endDate, out ProtectedAccount paRet, bool transactAlreadyStarted)
 
bool AddTemporaryProtectedAccount (string accountName, DateTime startDate, DateTime endDate, ProtectedAccountType pat, out ProtectedAccount paRet)
 Add a temporary protected account by its name, its start and end dates and its type and return it if succeeded. More...
 
bool AddTemporaryProtectedAccountWithTransact (string accountName, DateTime startDate, DateTime endDate, ProtectedAccountType pat, out ProtectedAccount paRet, bool transactAlreadyStarted)
 
bool AddTemporaryProtectedAccount (string accountName, DateTime startDate, DateTime endDate, ProtectedAccountType pat)
 Add a temporary protected account by its name, its start and end dates and its type. More...
 
bool AddTemporaryProtectedAccountWithTransact (string accountName, DateTime startDate, DateTime endDate, ProtectedAccountType pat, bool transactAlreadyStarted)
 
bool AddTemporaryProtectedAccount (string accountName, DateTime startDate, DateTime endDate, ProtectedAccountType pat, bool bCopyCfgFromPrmPa)
 Add a temporary protected account by its name, its start and end dates, its type and a bool to copy the configuration of the corresponding permanent protected account if any. More...
 
bool AddTemporaryProtectedAccountWithTransact (string accountName, DateTime startDate, DateTime endDate, ProtectedAccountType pat, bool bCopyCfgFromPrmPa, bool transactAlreadyStarted)
 
bool AddTemporaryProtectedAccount (string accountName, DateTime startDate, DateTime endDate, ProtectedAccountType pat, string idPaToCopyCfgFrom)
 Add a temporary protected account by its name, its start and end dates, its type and another protected account to copy all configuration from. More...
 
bool AddTemporaryProtectedAccountWithTransact (string accountName, DateTime startDate, DateTime endDate, ProtectedAccountType pat, string idPaToCopyCfgFrom, bool transactAlreadyStarted)
 
bool AddProtectedAccount (string accountName, ProtectedAccountType pat, string idPaToCopyCfgFrom, out ProtectedAccount paRet)
 Adds a permanent protected account with its name, the type of account, the ID of another protected account from which the entire configuration is copied, returns if it was successful, and if so returns created object. More...
 
bool AddProtectedAccountWithTransact (string accountName, ProtectedAccountType pat, string idPaToCopyCfgFrom, out ProtectedAccount paRet, bool transactAlreadyStarted)
 
bool AddTemporaryProtectedAccount (string accountName, DateTime startDate, DateTime endDate, ProtectedAccountType pat, string idPaToCopyCfgFrom, out ProtectedAccount paRet)
 Adds a temporary protected account with its name, the start and end dates, the type of account, the ID of another protected account from which the entire configuration is copied, returns if it was successful, and if so returns created object. More...
 
bool AddTemporaryProtectedAccountWithTransact (string accountName, DateTime startDate, DateTime endDate, ProtectedAccountType pat, string idPaToCopyCfgFrom, out ProtectedAccount paRet, bool transactAlreadyStarted)
 
bool DeleteProtectedAccount (ProtectedAccount protectedAccount)
 Delete a protected account. More...
 
bool DeleteProtectedAccount (string accountName)
 Delete a protected account by name. More...
 
bool DeleteTemporaryProtectedAccount (string accountName, DateTime startDate, DateTime endDate)
 Delete a temporary protected account by its name and start and end dates. More...
 

Asynchronous task management

enum  OperationType
 Operation types for ExecuteOperation method. More...
 
List< TaskAsyncResultQueryStateAsyncTask (ref TaskAsync taskAsync)
 Queries the state asynchronous task. More...
 
bool UnsubcribeQueryAsyncTask (TaskAsync taskAsync)
 Unsubcribes the query asynchronous task. After this method, it is not possible to query any more the task state, but the asynchronous task is working on. More...
 
bool CancelAsyncTask (TaskAsync taskAsync)
 Cancels the asynchronous task. More...
 
bool ExecuteOperation (OperationType operationType, string[] itemKeys, IOperationParams operationParams, IOperationNotify callBackInstance)
 Executes one operation. More...
 

Session management

bool Logoff (string session)
 Logoff an interactive session. More...
 
TaskAsync LogoffAsync (string[] sessions)
 Logoffs interactive and IIS sessions in asynchronous way. More...
 
bool Logoff (Session session)
 Logoff an interactive session. More...
 
TaskAsync LogoffAsync (List< Session > sessions)
 Logoffs interactive and IIS sessions in asynchronous way. More...
 
bool LogoffIis (string session)
 Logoff a IIS session. More...
 
bool LogoffIis (IisSession session)
 Logoff a IIS session. More...
 
bool Lock (string session)
 Lock an interactive session by specifying the session name. More...
 
TaskAsync LockAsync (string[] sessions)
 Locks interactive sessions in asynchronous way. More...
 
bool Lock (Session session)
 Lock an interactive session. More...
 
TaskAsync LockAsync (List< Session > sessions)
 Locks interactive sessions in asynchronous way. More...
 
bool Reset (string session)
 Reset an interactive session. More...
 
bool ResetRas (string session)
 Reset a RAS session. More...
 
bool ResetIis (string session)
 Reset a IIS session. More...
 
bool Reset (Session session)
 Reset a session with a Session instance retrieved from the server. More...
 
TaskAsync ResetAsync (List< Session > sessions)
 Reset sessions with several Session instances retrieved from the server, in asynchronous way. More...
 
bool SendPopup (string session, string message)
 Overloaded function to send a popup to an interactive session. See the full version SendPopup(string, string, string) method. More...
 
TaskAsync SendPopupAsync (string[] sessions, string message)
 Overloaded function to send a popup to several interactive sessions in asynchronous way. See the full version SendPopupAsync(string[], string, string) method. More...
 
bool SendPopup (string session, string message, string title)
 Send a popup to an interactive session. More...
 
TaskAsync SendPopupAsync (string[] sessions, string message, string title)
 Sends a popup to several interactive sessions in asynchronous way. More...
 
bool SendPopup (Session session, string message)
 Overloaded function to shutdown a computer by specifying a Session instance retrieved from the UserLock server. See the full version SendPopup(Session, string, string) method. More...
 
TaskAsync SendPopupAsync (List< Session > sessions, string message)
 Overloaded function to send a popup to several interactive sessions retrieved from the UserLock server, in asynchronous way. See the full version SendPopupAsync(List<Session>, string, string) method. More...
 
bool SendPopup (Session session, string message, string title)
 Send a popup to an interactive session with a Session instance retrieved from the server. More...
 
TaskAsync SendPopupAsync (List< Session > sessions, string message, string title)
 Sends a popup to several interactive sessions in asynchronous way. More...
 
void SendPopupToUser (string userName, string message)
 Overloaded function to send a popup in all sessions of a specific user. See the full version SendPopupToUser(string, string, string) method. More...
 
TaskAsync SendPopupAsyncToUsers (string[] userNames, string message)
 Overloaded function to send a popup in all sessions of several specific users in asynchronous way. See the full version SendPopupAsyncToUsers(string[], string, string) method. More...
 
void SendPopupToUser (string userName, string message, string title)
 Send a popup in all sessions of a specific user. More...
 
TaskAsync SendPopupAsyncToUsers (string[] userNames, string message, string title)
 Send a popup in all sessions of several specific users in asynchronous way. More...
 
void SendPopupToMachine (string machineName, string message)
 Overloaded function to send a popup to all sessions on a specific machine. See the full version SendPopupToMachine(string, string, string) method. More...
 
TaskAsync SendPopupAsyncToMachines (string[] machineNames, string message)
 Overloaded function to send a popup to all sessions on several specific machines in asynchronous way. See the full version SendPopupAsyncToMachines(string[], string, string) method. More...
 
void SendPopupToMachine (string machineName, string message, string title)
 Send a popup to all sessions on a specific machine. More...
 
TaskAsync SendPopupAsyncToMachines (string[] machineNames, string message, string title)
 Send a popup to all sessions on several specific machines in asynchronous way. More...
 
void SendPopupToGroup (string protectedGroupName, string message)
 Overloaded function to send a popup to all members of a protected group or OU. See the full version SendPopupToGroup(string, string, string) method. More...
 
TaskAsync SendPopupAsyncToGroups (string[] protectedGroupNames, string message)
 Overloaded function to send a popup to all members of several protected groups or OUs in asynchronous way. See the full version SendPopupAsyncToGroups(string[], string, string) method. More...
 
void SendPopupToGroup (string protectedGroupName, string message, string title)
 Send a popup to all members of a protected group or OU. More...
 
TaskAsync SendPopupAsyncToGroups (string[] protectedGroupNames, string message, string title)
 Send a popup to all members of several protected groups or OUs in asynchronous way. More...
 

Agent management

bool InstallAgent (string computer)
 Install the agent for interactive sessions on a workstation or a terminal server. More...
 
bool InstallRrasAgent (string computer)
 Install the agent for RRAS sessions on a Microsoft RRAS server (deprecated). More...
 
bool InstallIasAgent (string computer)
 Install the agent for RADIUS sessions on a Microsoft NPS (IAS) server. More...
 
bool InstallIisAgent (string computer)
 Install the agent for IIS sessions on a Microsoft IIS server. More...
 
bool InstallAgent (MachineState machineState)
 Install an agent with a MachineState instance retrieved from the server. More...
 
TaskAsync InstallAgentAsync (List< MachineState > machineStates)
 Install multiple agents asynchronously, specifying MachineState instances retrieved from the UserLock server. More...
 
bool UninstallAgent (string computer)
 Uninstall the agent for interactive sessions from a workstation or a terminal server. More...
 
bool UninstallRrasAgent (string computer)
 Uninstall the agent for RRAS sessions from a Microsoft RRAS server (deprecated). More...
 
bool UninstallIasAgent (string computer)
 Uninstall the agent for RADIUS sessions from a Microsoft IAS/NPS server. More...
 
bool UninstallIisAgent (string computer)
 Uninstall the agent for IIS sessions from a Microsoft IIS server. More...
 
bool UninstallAgent (MachineState machineState)
 Uninstall the agent by using a MachineState instance retrieved from the server. More...
 
TaskAsync UninstallAgentAsync (List< MachineState > machineStates)
 Uninstall agents with several MachineState instances retrieved from the server, in asynchronous way. More...
 

Computer management

bool Reboot (string computer)
 Reboot a computer. More...
 
TaskAsync RebootAsync (string[] computers)
 Reboots several computers in asynchronous way. More...
 
bool Reboot (MachineState machineState)
 Reboot a computer by specifying a MachineState instance retrieved from the UserLock server. More...
 
TaskAsync RebootAsync (List< MachineState > machineStates)
 Reboot multiple computers asynchronously, specifying MachineState instances retrieved from the UserLock server. More...
 
bool WakeUp (string computer)
 Wakes up a computer. More...
 
TaskAsync WakeUpAsync (string[] computers)
 Wakes up several computers in asynchronous way. More...
 
bool WakeUp (MachineState machineState)
 Wakes up a computer by specifying a MachineState instance retrieved from the UserLock server. More...
 
TaskAsync WakeUpAsync (List< MachineState > machineStates)
 Wake up multiple computers asynchronously, specifying MachineState instances retrieved from the UserLock server. More...
 
bool Shutdown (string computer)
 Overloaded function to shutdown a computer. See the full version Shutdown(string, ExecutionMode, NotifyMode, double, ForceMode, string) method. More...
 
TaskAsync ShutdownAsync (string[] computers)
 Overloaded function to shutdown several computers in asynchronous way. See the full version ShutdownAsync(string[], ExecutionMode, NotifyMode, double, ForceMode, string) method. More...
 
bool Shutdown (string computer, ExecutionMode executionMode, ForceMode forceMode, string message)
 Overloaded function to shutdown a computer. See the full version Shutdown(string, ExecutionMode, NotifyMode, double, ForceMode, string) method. More...
 
TaskAsync ShutdownAsync (string[] computers, ExecutionMode executionMode, ForceMode forceMode, string message)
 Overloaded function to shutdown several computers in asynchronous way. See the full version ShutdownAsync(string[], ExecutionMode, NotifyMode, double, ForceMode, string) method. More...
 
bool Shutdown (string computer, double timeOut, string message)
 Overloaded function to shutdown a computer. See the full version Shutdown(string, ExecutionMode, NotifyMode, double, ForceMode, string) method. More...
 
TaskAsync ShutdownAsync (string[] computers, double timeOut, string message)
 Overloaded function to shutdown several computers in asynchronous way. See the full version ShutdownAsync(string[], ExecutionMode, NotifyMode, double, ForceMode, string) method. More...
 
bool Shutdown (string computer, ExecutionMode executionMode, NotifyMode notifyMode, double timeOut, ForceMode forceMode, string message)
 Shutdown a computer. More...
 
TaskAsync ShutdownAsync (string[] computers, ExecutionMode executionMode, NotifyMode notifyMode, double timeOut, ForceMode forceMode, string message)
 Shutdowns several computers in asynchronous way. More...
 
bool Shutdown (MachineState machineState)
 Shutdown a computer by specifying a MachineState instance retrieved from the UserLock server. More...
 
TaskAsync ShutdownAsync (List< MachineState > machineStates)
 Overloaded function to shutdown several computers in asynchronous way, by specifying MachineState instances retrieved from the UserLock server. See the full version ShutdownAsync(List<MachineState>, ExecutionMode, NotifyMode, double, ForceMode, string) method. More...
 
TaskAsync ShutdownAsync (List< MachineState > machineStates, ExecutionMode executionMode, NotifyMode notifyMode, double timeOut, ForceMode forceMode, string message)
 Shut down multiple computers asynchronously, specifying MachineState instances retrieved from the UserLock server. More...
 

Database management

bool CreateTable ()
 Create or recreate the UserLogonEvents table where is stored the logon history in the UserLock database. More...
 
bool CreateTimeIndex ()
 Creates an index on the EventTime field of the UserLogonEvents table to speed up queries on time frames More...
 
bool DeleteTimeIndex ()
 Deletes the index on the EventTime field of the UserLogonEvents table. More...
 
bool ExecuteSqlCommand (string command)
 Executes an SQL command on the UserLock database. More...
 
bool CompactDatabase ()
 Compacts the default UserLock database. More...
 
bool CleanOldLogons (int days)
 Removes logon events older than a specific number of days from the logon history database More...
 
bool CleanOldLogons (DateTime limitDate)
 Removes logon events older than a specific date from the logon history database. More...
 
bool CleanAllLogons ()
 Clear all logon events the logon history database. More...
 
void UnblockAUser (string accountName)
 Unblock a specific account with the provided user name More...
 
void BlockAUser (string accountName, bool createPermanentPA, string message, bool closeAllSessions)
 Blocks a specific account with the provided user name (create the related protected account if it doesn't exist). More...
 
void BlockAUser (string accountName, bool createPermanentPA, string message, bool closeAllSessions, bool transactAlreadyStarted)
 
bool ExistingActiveTemporaryProtectedAccount (string protectedAccountName)
 Return True if the provided account name has already an active temporary protected account More...
 
void CloseAllSessionAfterBlocking (string protectedAccountName)
 Close all the opened sessions of a protected account after this user has been blocked More...
 
void MarkAllAdminActionAsReadFor (string adminName)
 

Initial Access Point Policy

InitialAccessPointPolicy GetInitialAccessPointPolicy (string paIdentifier)
 Get the InitialAccessPointPolicy for paIdentifier More...
 
InitialAccessPointPolicy GetTemporaryInitialAccessPointPolicy (string accountName, DateTime startDate, DateTime endDate)
 Get a temporary InitialAccessPointPolicy for accountName. More...
 
bool AddInitialAccessPointPolicyToGroup (string groupName, out InitialAccessPointPolicy policyRet)
 Add a initial access point policy to a group. More...
 
bool AddInitialAccessPointPolicyToGroup (string groupName)
 Add a initial access point policy to a group. More...
 
bool AddInitialAccessPointPolicyToUser (string userName, out InitialAccessPointPolicy policyRet)
 Add a initial access point policy to a User. More...
 
bool AddInitialAccessPointPolicyToUser (string userName)
 Add a initial access point policy to a User. More...
 
bool AddInitialAccessPointPolicyToOu (string ouName, out InitialAccessPointPolicy policyRet)
 Add a initial access point policy to a OU. More...
 
bool AddInitialAccessPointPolicyToOu (string ouName)
 Add a initial access point policy to a OU. More...
 
bool AddTemporaryInitialAccessPointPolicyToOu (string accountName, DateTime startDate, DateTime endDate)
 Add a temporary initial access point policy to a OU. More...
 
bool AddTemporaryInitialAccessPointPolicyToOu (string accountName, DateTime startDate, DateTime endDate, out InitialAccessPointPolicy policyRet)
 Add a temporary initial access point policy to a OU. More...
 
bool AddTemporaryInitialAccessPointPolicyToGroup (string accountName, DateTime startDate, DateTime endDate)
 Add a temporary initial access point policy to a Group. More...
 
bool AddTemporaryInitialAccessPointPolicyToGroup (string accountName, DateTime startDate, DateTime endDate, out InitialAccessPointPolicy policyRet)
 Add a temporary initial access point policy to a Group. More...
 
bool AddTemporaryInitialAccessPointPolicyToUser (string accountName, DateTime startDate, DateTime endDate)
 Add a temporary initial access point policy to a User. More...
 
bool AddTemporaryInitialAccessPointPolicyToUser (string accountName, DateTime startDate, DateTime endDate, out InitialAccessPointPolicy policyRet)
 Add a temporary initial access point policy to a User. More...
 

Session Limit Policy

SessionLimitPolicy GetSessionLimitPolicy (string paIdentifier)
 Get the SessionLimitPolicy for paIdentifier More...
 
SessionLimitPolicy GetTemporarySessionLimitPolicy (string accountName, DateTime startDate, DateTime endDate)
 Get a temporary SessionLimitPolicy for accountName. More...
 
bool AddSessionLimitPolicyToGroup (string groupName, out SessionLimitPolicy policyRet)
 Add a Session Limit policy to a group. More...
 
bool AddSessionLimitPolicyToGroup (string groupName)
 Add a Session Limit policy to a group. More...
 
bool AddSessionLimitPolicyToUser (string userName, out SessionLimitPolicy policyRet)
 Add a Session Limit policy to a User. More...
 
bool AddSessionLimitPolicyToUser (string userName)
 Add a Session Limit policy to a User. More...
 
bool AddSessionLimitPolicyToOu (string ouName, out SessionLimitPolicy policyRet)
 Add a Session Limit policy to a OU. More...
 
bool AddSessionLimitPolicyToOu (string ouName)
 Add a Session Limit policy to a OU. More...
 
bool AddTemporarySessionLimitPolicyToOu (string accountName, DateTime startDate, DateTime endDate)
 Add a temporary Session Limit policy to a OU. More...
 
bool AddTemporarySessionLimitPolicyToOu (string accountName, DateTime startDate, DateTime endDate, out SessionLimitPolicy policyRet)
 Add a temporary Session Limit policy to a OU. More...
 
bool AddTemporarySessionLimitPolicyToGroup (string accountName, DateTime startDate, DateTime endDate)
 Add a temporary Session Limit policy to a Group. More...
 
bool AddTemporarySessionLimitPolicyToGroup (string accountName, DateTime startDate, DateTime endDate, out SessionLimitPolicy policyRet)
 Add a temporary Session Limit policy to a Group. More...
 
bool AddTemporarySessionLimitPolicyToUser (string accountName, DateTime startDate, DateTime endDate)
 Add a temporary Session Limit policy to a User. More...
 
bool AddTemporarySessionLimitPolicyToUser (string accountName, DateTime startDate, DateTime endDate, out SessionLimitPolicy policyRet)
 Add a temporary Session Limit policy to a User. More...
 

Workstation restrictions Policy

WorkstationPolicy GetWorkstationPolicy (string paIdentifier)
 Get the WorkstationPolicy for paIdentifier More...
 
WorkstationPolicy GetTemporaryWorkstationPolicy (string accountName, DateTime startDate, DateTime endDate)
 Get a temporary WorkstationPolicy for accountName. More...
 
bool AddWorkstationPolicyToGroup (string groupName, out WorkstationPolicy policyRet)
 Add a Workstation restrictions policy to a group. More...
 
bool AddWorkstationPolicyToGroup (string groupName)
 Add a Workstation restrictions policy to a group. More...
 
bool AddWorkstationPolicyToUser (string userName, out WorkstationPolicy policyRet)
 Add a Workstation restrictions policy to a User. More...
 
bool AddWorkstationPolicyToUser (string userName)
 Add a Workstation restrictions policy to a User. More...
 
bool AddWorkstationPolicyToOu (string ouName, out WorkstationPolicy policyRet)
 Add a Workstation restrictions policy to a OU. More...
 
bool AddWorkstationPolicyToOu (string ouName)
 Add a Workstation restrictions policy to a OU. More...
 
bool AddTemporaryWorkstationPolicyToOu (string accountName, DateTime startDate, DateTime endDate)
 Add a temporary Workstation restrictions policy to a OU. More...
 
bool AddTemporaryWorkstationPolicyToOu (string accountName, DateTime startDate, DateTime endDate, out WorkstationPolicy policyRet)
 Add a temporary Workstation restrictions policy to a OU. More...
 
bool AddTemporaryWorkstationPolicyToGroup (string accountName, DateTime startDate, DateTime endDate)
 Add a temporary Workstation restrictions policy to a Group. More...
 
bool AddTemporaryWorkstationPolicyToGroup (string accountName, DateTime startDate, DateTime endDate, out WorkstationPolicy policyRet)
 Add a temporary Workstation restrictions policy to a Group. More...
 
bool AddTemporaryWorkstationPolicyToUser (string accountName, DateTime startDate, DateTime endDate)
 Add a temporary Workstation restrictions policy to a User. More...
 
bool AddTemporaryWorkstationPolicyToUser (string accountName, DateTime startDate, DateTime endDate, out WorkstationPolicy policyRet)
 Add a temporary Workstation restrictions policy to a User. More...
 

Detailed Description

Instance of a local or remote UserLock server

Member Enumeration Documentation

Operation types for ExecuteOperation method.

Constructor & Destructor Documentation

UserLockServer ( string  serverName)

Create an instance of UserLockServer by providing the address of the UserLock server

Parameters
serverNameAddress of the UserLock server (name/FQDN/IP address). Specify a dot (.) if the server is local.

Connect to a local server and check that the connection was successful

UserLockServer userLockServer = new UserLockServer(".");
if (!userLockServer.Connected)
Console.WriteLine(userLockServer.ConnectionException.Message);

Connect to a remote server and check that the connection was successful

UserLockServer userLockServer = new UserLockServer("SERVERNAME");
if (!userLockServer.Connected)
Console.WriteLine(userLockServer.ConnectionException.Message);

Optimized server disconnection with the using statement. At the end of the scope the API is automatically disconnected from the UserLock server. Do so if you create many instances of the UserLockServer class for short periods.

using (UserLockServer userLockServer = new UserLockServer("tafserver1"))
{
// Do what you have to do
}

Create an instance of UserLockServer connected to the local UserLock service.

Member Function Documentation

string GetConnectionString ( )

Gets the connection string to the database used by the UserLock server.

int TestUserLockSession ( string  userName,
string  computerName,
string  clientName,
string  clientIps,
SessionType  sessionType,
DateTime  dateTime,
out bool  isAllowed,
out string  ulSrvAnswer 
)

Tests if a new UserLock session would be allowed or denied.

Parameters
userNameThe user name.
computerNameThe computer name.
clientNameThe client name.
clientIpsThe client IP(s).
sessionTypeThe session type.
dateTimeThe date time at which to test the logon.
isAllowedIf set to true, a new UserLock session would be allowed.
ulSrvAnswerThe answer of the UserLock server.
Returns
The error code, 0 if no error.
Exceptions
UserExceptionThis method is not supported in UserLock services older than 9 version.
string TestUserLockSession ( string  userName)

Tests if a new UserLock session would be allowed or denied.

Parameters
userNameThe user name.
Returns
The answer of the UserLock server.
Exceptions
UserExceptionThis method is not supported in UserLock services older than 9 version.
bool CheckAdminCredentials ( string  account,
string  domain,
string  password 
)

Check if the credentials for an admin account are valid

Parameters
accountAccount name
domainDomain of the account
passwordPassword for this account
Returns
ReportedUser GetReportedUser ( string  userName)

Get interactive sessions for a specific user. See the class ReportedUser.

Parameters
userNameUser account name
Returns
An instance of the ReportedUser class

Example: Logoff all sessions of the user myuser

UserLockServer userLockServer = new UserLockServer(".")
ReportedUser reportedUser = userLockServer.GetReportedUser("myuser");
foreach (Session userSession in reportedUser.UserSessions)
if (!userLockServer.Logoff(userSession))
Console.WriteLine("Failed to logoff the session {0}. Error: {1}", userSession.DisplayName, userLockServer.Connection.LastMessage);
ReportedMachine GetReportedMachine ( string  machineName)

Get interactive sessions on a specific computer. See the class ReportedMachine.

Parameters
machineNameName of the computer
Returns
An instance of the ReportedMachine class

Example: Logoff all sessions on the computer MYCOMPUTER.

UserLockServer userLockServer = new UserLockServer(".")
ReportedMachine reportedMachine = userLockServer.GetReportedMachine("MYCOMPUTER");
foreach (Session machineSession in reportedMachine.MachineSessions)
if (!userLockServer.Logoff(machineSession))
Console.WriteLine("Failed to logoff the session {0}. Error: {1}", machineSession.DisplayName, userLockServer.Connection.LastMessage);
TimeQuotaStatus GetUserQuotaStatus ( string  userAccount)

Get the quota status for a user. See the documentation of the class TimeQuotaStatus

Parameters
userAccountUser account name. The domain is needed if the account is from another domain (DOMAIN\account).

Example: Get the quota status for a specific user.

UserLockServer userLockServer = new UserLockServer(".");
TimeQuotaStatus timeQuotaStatus = userLockServer.GetUserQuotaStatus("DOMAIN\user");
void DecreaseConsumedTime ( string  userAccount,
SessionType  sessionType,
TimeQuota.Period  period,
int  minutes 
)

Decrease the time consumed by a user for a specific type of session and quota period.

Parameters
userAccountUser account name. The domain is needed if the account is from another domain (DOMAIN\account).
sessionTypeType of the session. See SessionType enum.
periodTime quota period. See the enum TimeQuota.Period.
minutesTime length to decrease in minutes.

Example: Decrease the daily consumed time on workstations for a specific user by 1 hour.

UserLockServer userLockServer = new UserLockServer(".");
userLockServer.DecreaseConsumedTime("DOMAIN\user", SessionType.Workstation, TimeQuota.Period.Day, 60);
void DecreaseConsumedTime ( string  userAccount,
SessionType  sessionType,
TimeQuota.Period  period,
TimeSpan  timeToDecrease 
)

Decrease the time consumed by a user for a specific type of session and quota period.

Parameters
userAccountUser account name. The domain is needed if the account is from another domain (DOMAIN\account).
sessionTypeType of the session. See SessionType enum.
periodTime quota period. See the enum TimeQuota.Period.
timeToDecreaseTime length to decrease.

Example: Decrease the daily consumed time on workstations for a specific user by 1 hour.

UserLockServer userLockServer = new UserLockServer(".");
userLockServer.DecreaseConsumedTime("DOMAIN\user", SessionType.Workstation, TimeQuota.Period.Day, new TimeSpan(1, 0, 0));
void ResetConsumedTime ( string  userAccount)

Reset the time consumed by a user to 0 for all types of session and all quota periods.

Parameters
userAccountUser account name. The domain is needed if the account is from another domain (DOMAIN\account).

Example: Reset the consumed time for a specific user.

UserLockServer userLockServer = new UserLockServer(".");
userLockServer.ResetConsumedTime("DOMAIN\user");
void ResetConsumedTime ( string  userAccount,
SessionType  sessionType,
TimeQuota.Period  period 
)

Reset the time consumed by a user to 0 for a specific type of session and quota period.

Parameters
userAccountUser account name. The domain is needed if the account is from another domain (DOMAIN\account).
sessionTypeType of the session. See SessionType enum.
periodTime quota period. See the enum TimeQuota.Period.

Example: Reset the daily consumed time on workstations for a specific user.

UserLockServer userLockServer = new UserLockServer(".");
userLockServer.ResetConsumedTime("DOMAIN\user", SessionType.Workstation, TimeQuota.Period.Day);
void Refresh ( )

Refresh specific UserLock data.

Example: Refresh user sessions after reseting a session. The new list of interactive sessions should reflect that the reseted session no longer exists.

UserLockServer userLockServer = new UserLockServer(".");
userLockServer.Reset('COMPUTERNAME/1');
userLockServer.Refresh(ServerDataElement.UserSessions);
foreach (InteractiveSession session in userLockServer.InteractiveSessions)
Console.WriteLine("{0}\n", session.Name);
void Refresh ( ServerDataElement  elements)

Refresh all UserLock data.

void Reconnect ( )

Reconnect to the UserLock server.

ProtectedAccount GetProtectedAccount ( string  identifier)

Get a temporary protected account by its identifier.

OUT: The concerned protected account object, null if no such protected account.

Parameters
identifierIN : The identifier of the protected account.
ProtectedAccount GetProtectedAccount ( string  identifier,
ProtectedAccountBase.AccountPropertyList  propertyList 
)

Get a protected account.

Parameters
identifierThe identifier of the protected account.
propertyListProperties to load from the server. See the enum AccountPropertyList. Optional parameter. By default all properties are loaded.

Example: Get a protected account and display the maximum number of allowed concurrent interactive sessions.

UserLockServer userLockServer = new UserLockServer(".");
ProtectedAccount protectedAccount = userLockServer.GetProtectedAccount("ProtectedAccountName", ProtectedAccountBase.AccountPropertyList.UserLock);
Console.WriteLine("Maximum number of simultaneous interactive sessions for {0}: {1}\n", protectedAccount.Name, protectedAccount.NbConcurrentLogins);
ProtectedAccount GetTemporaryProtectedAccount ( string  accountName,
DateTime  startDate,
DateTime  endDate 
)

Gets the temporary protected account from the account name and start and end dates.

Parameters
accountNameName of the account.
startDateThe start date.
endDateThe end date.
Returns
The concerned protected account object, null if no such protected account.
Exceptions
UserExceptionThis method is not supported in UserLock services older than 8 version.
ProtectedAccountEffective GetProtectedAccountEffective ( string  accountName,
ProtectedAccountBase.AccountPropertyList  propertyList,
ProtectedAccount.ComplexEffRestsPropertyList  cersPropertyList 
)

Get effective restrictions of a user (depending on the policy).

Parameters
accountNameName of the user account.
propertyListList of properties to calculate. See the enum AccountPropertyList. Optional parameter. By default all properties are loaded.
cersPropertyListList of complex properties to calculate. See the enum ComplexEffRestsPropertyList. Optional parameter. By default all complex properties are loaded.
Returns
Effective restrictions of the user (depending on the policy).

Example: Get effective restrictions of a user and display the maximum number of allowed concurrent interactive sessions.

UserLockServer userLockServer = new UserLockServer(".");
ProtectedAccountEffective protectedAccountEffective = userLockServer.GetProtectedAccountEffective("ProtectedAccountName", ProtectedAccountBase.AccountPropertyList.UserLock);
Console.WriteLine("Maximum number of simultaneous interactive sessions effectives for {0}: {1}\n", protectedAccountEffective.Name, protectedAccountEffective.NbConcurrentLogins);
bool DoesProtectedAccountExist ( string  accountName)

Check if a protected account exists.

Parameters
accountNameName of the protected account.
Returns
Returns true if the protected account exists, false otherwise.
bool AddProtectedGroup ( string  groupName,
out ProtectedAccount  paRet 
)

Add a new protected group and return it if succeeded.

Parameters
groupNameName of the Windows/AD group. Specify the domain name if the group is from another domain (e.g. DOMAINNAME\GroupName).
paRetnull if failed, the created instance if succeeded.
Returns
True if succeeded, False otherwise.

Example: Create a new protected group for everyone

UserLockServer userLockServer = new UserLockServer(".");
if (!userLockServer.AddProtectedGroup("Everyone"))\n
Console.WriteLine("Failed to create the group. Error: {0}\n", userLockServer.Connection.LastMessage);
bool AddProtectedGroup ( string  groupName)

Add a new protected group.

Parameters
groupNameName of the Windows/AD group. Specify the domain name if the group is from another domain (e.g. DOMAINNAME\GroupName).
Returns
True if succeeded, False otherwise.

Example: Create a new protected group for everyone

UserLockServer userLockServer = new UserLockServer(".");
if (!userLockServer.AddProtectedGroup("Everyone"))\n
Console.WriteLine("Failed to create the group. Error: {0}\n", userLockServer.Connection.LastMessage);
bool AddProtectedUser ( string  userName,
out ProtectedAccount  paRet 
)

Add a new protected user and return it if succeeded.

Parameters
userNameName of the Windows/AD user account. Specify the domain name if the account is from another domain (e.g. DOMAINNAME\UserName).
paRetnull if failed, the created instance if succeeded.
Returns
True if succeeded, False otherwise.

Example: Create a new protected account for the user Bob

UserLockServer userLockServer = new UserLockServer(".");
if (!userLockServer.AddProtectedGroup("DOMAINNAME\bob"))
Console.WriteLine("Failed to create the protected user. Error: {0}\n", userLockServer.Connection.LastMessage);
bool AddProtectedUser ( string  userName)

Add a new protected user.

Parameters
userNameName of the Windows/AD user account. Specify the domain name if the account is from another domain (e.g. DOMAINNAME\UserName).
Returns
True if succeeded, False otherwise.

Example: Create a new protected account for the user Bob

UserLockServer userLockServer = new UserLockServer(".");
if (!userLockServer.AddProtectedGroup("DOMAINNAME\bob"))
Console.WriteLine("Failed to create the protected user. Error: {0}\n", userLockServer.Connection.LastMessage);
bool AddProtectedOu ( string  ouDistinguishedName,
out ProtectedAccount  paRet 
)

Add a new protected organizational unit and return it if succeeded.

Parameters
ouDistinguishedNameDistinguished name of the AD organizational unit.
paRetnull if failed, the created instance if succeeded.
Returns
True if succeeded, False otherwise.

Example: Create a new protected account for the OU "OU=MyUsers,DC=domain,DC=local"

UserLockServer userLockServer = new UserLockServer(".");
if (!userLockServer.AddProtectedOu("OU=MyUsers,DC=domain,DC=local"))
Console.WriteLine("Failed to create the protected OU. Error: {0}\n", userLockServer.Connection.LastMessage);
bool AddProtectedOu ( string  ouDistinguishedName)

Add a new protected organizational unit.

Parameters
ouDistinguishedNameDistinguished name of the AD organizational unit.
Returns
True if succeeded, False otherwise.

Example: Create a new protected account for the OU "OU=MyUsers,DC=domain,DC=local"

UserLockServer userLockServer = new UserLockServer(".");
if (!userLockServer.AddProtectedOu("OU=MyUsers,DC=domain,DC=local"))
Console.WriteLine("Failed to create the protected OU. Error: {0}\n", userLockServer.Connection.LastMessage);
bool AddProtectedAccount ( string  accountName,
ProtectedAccountType  pat 
)

Add a protected account by its name and its type.

Parameters
accountNameName of the protected account.
patType of the protected account.
Returns
True if succeeded, False otherwise.
bool AddProtectedAccount ( string  accountName,
ProtectedAccountType  pat,
string  idPaToCopyCfgFrom 
)

Add a protected account by its name, its type and another protected account to copy all configuration from.

Parameters
accountNameName of the protected account.
patType of the protected account.
idPaToCopyCfgFromIdentifier of the protected account to copy all configuration from. Note that account types can be different.
Returns
True if succeeded, False otherwise.
bool AddTemporaryProtectedUser ( string  accountName,
DateTime  startDate,
DateTime  endDate 
)

Add a user temporary protected account by its name.

Parameters
accountNameName of the temporary protected account.
startDateStart date of the temporary protected account.
endDateEnd date of the temporary protected account.
Returns
True if succeeded, False otherwise.
bool AddTemporaryProtectedGroup ( string  accountName,
DateTime  startDate,
DateTime  endDate 
)

Add a group temporary protected account by its name.

Parameters
accountNameName of the temporary protected account.
startDateStart date of the temporary protected account.
endDateEnd date of the temporary protected account.
Returns
True if succeeded, False otherwise.
bool AddTemporaryProtectedOu ( string  accountName,
DateTime  startDate,
DateTime  endDate 
)

Add a OU temporary protected account by its name.

Parameters
accountNameName of the temporary protected account.
startDateStart date of the temporary protected account.
endDateEnd date of the temporary protected account.
Returns
True if succeeded, False otherwise.
bool AddTemporaryProtectedUser ( string  accountName,
DateTime  startDate,
DateTime  endDate,
out ProtectedAccount  paRet 
)

Add a user temporary protected account by its name and return it if succeeded.

Parameters
accountNameName of the temporary protected account.
startDateStart date of the temporary protected account.
endDateEnd date of the temporary protected account.
paRetnull if failed, the created instance if succeeded.
Returns
True if succeeded, False otherwise.
bool AddTemporaryProtectedGroup ( string  accountName,
DateTime  startDate,
DateTime  endDate,
out ProtectedAccount  paRet 
)

Add a group temporary protected account by its name and return it if succeeded.

Parameters
accountNameName of the temporary protected account.
startDateStart date of the temporary protected account.
endDateEnd date of the temporary protected account.
paRetnull if failed, the created instance if succeeded.
Returns
True if succeeded, False otherwise.
bool AddTemporaryProtectedOu ( string  accountName,
DateTime  startDate,
DateTime  endDate,
out ProtectedAccount  paRet 
)

Add a OU temporary protected account by its name and return it if succeeded.

Parameters
accountNameName of the temporary protected account.
startDateStart date of the temporary protected account.
endDateEnd date of the temporary protected account.
paRetnull if failed, the created instance if succeeded.
Returns
True if succeeded, False otherwise.
bool AddTemporaryProtectedAccount ( string  accountName,
DateTime  startDate,
DateTime  endDate,
ProtectedAccountType  pat,
out ProtectedAccount  paRet 
)

Add a temporary protected account by its name, its start and end dates and its type and return it if succeeded.

Parameters
accountNameName of the temporary protected account.
startDateStart date of the temporary protected account.
endDateEnd date of the temporary protected account.
patType of the temporary protected account.
paRetnull if failed, the created instance if succeeded.
Returns
True if succeeded, False otherwise.

Example: Add a temporary protected account for the Everyone group from 2014-05-01 00:00:00 to 2014-06-01 00:00:00.

UserLockServer userLockServer = new UserLockServer(".");
$AccountName = 'Everyone'
$AccountType = 'Group'
[DateTime]$StartDate = '2014-05-01 00:00:00'
[DateTime]$EndDate = '2014-06-01 00:00:00'
if (!$UserLockServer.AddTemporaryProtectedAccount($AccountName, $StartDate, $EndDate, $AccountType))
{
Write-Error("Failed to add a $AccountType temporary protected account for $AccountName from $StartDate to $EndDate. Error: <tt>"$($UserLockServer.Connection.LastMessage)</tt>".")
}
bool AddTemporaryProtectedAccount ( string  accountName,
DateTime  startDate,
DateTime  endDate,
ProtectedAccountType  pat 
)

Add a temporary protected account by its name, its start and end dates and its type.

Parameters
accountNameName of the temporary protected account.
startDateStart date of the temporary protected account.
endDateEnd date of the temporary protected account.
patType of the temporary protected account.
Returns
True if succeeded, False otherwise.

Example: Add a temporary protected account for the Everyone group from 2014-05-01 00:00:00 to 2014-06-01 00:00:00.

UserLockServer userLockServer = new UserLockServer(".");
$AccountName = 'Everyone'
$AccountType = 'Group'
[DateTime]$StartDate = '2014-05-01 00:00:00'
[DateTime]$EndDate = '2014-06-01 00:00:00'
if (!$UserLockServer.AddTemporaryProtectedAccount($AccountName, $StartDate, $EndDate, $AccountType))
{
Write-Error("Failed to add a $AccountType temporary protected account for $AccountName from $StartDate to $EndDate. Error: <tt>"$($UserLockServer.Connection.LastMessage)</tt>".")
}
bool AddTemporaryProtectedAccount ( string  accountName,
DateTime  startDate,
DateTime  endDate,
ProtectedAccountType  pat,
bool  bCopyCfgFromPrmPa 
)

Add a temporary protected account by its name, its start and end dates, its type and a bool to copy the configuration of the corresponding permanent protected account if any.

Parameters
accountNameName of the temporary protected account.
startDateStart date of the temporary protected account.
endDateEnd date of the temporary protected account.
patType of the temporary protected account.
bCopyCfgFromPrmPaIf True, copy the configuration of the corresponding permanent protected account if any.
Returns
True if succeeded, False otherwise.
bool AddTemporaryProtectedAccount ( string  accountName,
DateTime  startDate,
DateTime  endDate,
ProtectedAccountType  pat,
string  idPaToCopyCfgFrom 
)

Add a temporary protected account by its name, its start and end dates, its type and another protected account to copy all configuration from.

Parameters
accountNameName of the temporary protected account.
startDateStart date of the temporary protected account.
endDateEnd date of the temporary protected account.
patType of the temporary protected account.
idPaToCopyCfgFromIdentifier of the protected account to copy all configuration from. Note that account types can be different.
Returns
True if succeeded, False otherwise.
bool AddProtectedAccount ( string  accountName,
ProtectedAccountType  pat,
string  idPaToCopyCfgFrom,
out ProtectedAccount  paRet 
)

Adds a permanent protected account with its name, the type of account, the ID of another protected account from which the entire configuration is copied, returns if it was successful, and if so returns created object.

Parameters
accountNameAccount name.
patAccount type.
idPaToCopyCfgFromThe ID of another protected account from which the entire configuration is copied. Note that account types may be different.
paRetThe instance created on success, null otherwise.
Returns
True if successful, false otherwise.
bool AddTemporaryProtectedAccount ( string  accountName,
DateTime  startDate,
DateTime  endDate,
ProtectedAccountType  pat,
string  idPaToCopyCfgFrom,
out ProtectedAccount  paRet 
)

Adds a temporary protected account with its name, the start and end dates, the type of account, the ID of another protected account from which the entire configuration is copied, returns if it was successful, and if so returns created object.

Parameters
accountNameAccount name.
startDateStart date of temporary protected account.
endDateEnd date of temporary protected account.
patAccount type.
idPaToCopyCfgFromThe ID of another protected account from which the entire configuration is copied. Note that account types may be different.
paRetThe instance created on success, null otherwise.
Returns
True if successful, false otherwise.
bool DeleteProtectedAccount ( ProtectedAccount  protectedAccount)

Delete a protected account.

Parameters
protectedAccountProtected account to delete (Previously retrieved from the server).
bool DeleteProtectedAccount ( string  accountName)

Delete a protected account by name.

Parameters
accountNameProtected account to delete.

Example: Delete the protected account for the OU "OU=MyUsers,DC=domain,DC=local"

UserLockServer userLockServer = new UserLockServer(".");
if (!userLockServer.DeleteProtectedAccount("OU=MyUsers,DC=domain,DC=local"))
Console.WriteLine("Failed to delete the protected account. Error: {0}\n", userLockServer.Connection.LastMessage);
bool DeleteTemporaryProtectedAccount ( string  accountName,
DateTime  startDate,
DateTime  endDate 
)

Delete a temporary protected account by its name and start and end dates.

Parameters
accountNameName of the temporary protected account.
startDateStart date of the temporary protected account.
endDateEnd date of the temporary protected account.
Returns
True if succeeded, False otherwise.

Example: Delete a temporary protected account for the Everyone group from 2014-05-01 00:00:00 to 2014-06-01 00:00:00.

UserLockServer userLockServer = new UserLockServer(".");
$AccountName = 'Everyone'
[DateTime]$StartDate = '2014-05-01 00:00:00'
[DateTime]$EndDate = '2014-06-01 00:00:00'
if (!$UserLockServer.DeleteTemporaryProtectedAccount($AccountName, $StartDate, $EndDate))
{
Write-Error("Failed to delete a temporary protected account for $AccountName from $StartDate to $EndDate. Error: <tt>"$($UserLockServer.Connection.LastMessage)</tt>".")
}
List<TaskAsyncResult> QueryStateAsyncTask ( ref TaskAsync  taskAsync)

Queries the state asynchronous task.

Parameters
taskAsyncThe asynchronous task.
Returns
A list of TaskAsyncResult classes

Example: see LogoffAsync method.

bool UnsubcribeQueryAsyncTask ( TaskAsync  taskAsync)

Unsubcribes the query asynchronous task. After this method, it is not possible to query any more the task state, but the asynchronous task is working on.

Parameters
taskAsyncThe asynchronous task.
bool CancelAsyncTask ( TaskAsync  taskAsync)

Cancels the asynchronous task.

Parameters
taskAsyncThe asynchronous task.
bool ExecuteOperation ( OperationType  operationType,
string[]  itemKeys,
IOperationParams  operationParams,
IOperationNotify  callBackInstance 
)

Executes one operation.

Parameters
operationTypeType of the operation.
itemKeysThe item keys.
operationParamsThe operation parameters if it's needed.
callBackInstanceThe call back instance if it's needed to be notified of the results. It could be null, in that case there won't be result notifications.
Returns
Exceptions
UserExceptionNo send popup parameters. or No shutdown parameters. or Invalid operation type.
bool Logoff ( string  session)

Logoff an interactive session.

Parameters
sessionName of the session.

Example: Logoff an interactive session on the machine COMPUTER and with 1 as terminal session number."

UserLockServer userLockServer = new UserLockServer(".");
if (!userLockServer.Logoff("COMPUTER/1"))
Console.WriteLine("Failed to logoff the session. Error: {0}\n", userLockServer.Connection.LastMessage);
TaskAsync LogoffAsync ( string[]  sessions)

Logoffs interactive and IIS sessions in asynchronous way.

Parameters
sessionsName of the sessions.

Example: Logoff interactive sessions on the machines COMPUTER1, COMPUTER2 and COMPUTER3; with 1 as terminal session numbers (and 2 session type, terminal). And query the asynchronous results.

UserLockServer userLockServer = new UserLockServer(".");
UserLockServer.TaskAsync taskAsync = userLockServer.LogoffAsync(new string[3]{"COMPUTER1/1,2","COMPUTER2/1,2","COMPUTER3/1,2"});
if (taskAsync != null)
{
// loop to query asynchronous results
int results = 0;
while (results < 3)
{
List<UserLockServer.TaskAsyncResult> parcial_results = userLockServer.QueryStateAsyncTask(ref taskAsync);
if (parcial_results == null) return;
if (parcial_results.Count > 0)
{
// loop the results
foreach (UserLockServer.TaskAsyncResult result in parcial_results)
{
if (result.State)
Console.WriteLine("Succeeded to logoff the \"{0}\" session.", result.Key);
else
Console.WriteLine("Failed to logoff the \"{0}\" session, reason: \"{1}\".", result.Key, result.Details);
}
results += parcial_results.Count;
// wait to the next query
if(results < 3)
{
if(parcial_results.Count == 1)
Thread.Sleep(2000);
else
Thread.Sleep(1000);
}
}
else if (results < 3) // wait to the next query
Thread.Sleep(3000);
}
// check there is no more results
if( userLockServer.QueryStateAsyncTask(ref _taskAsync).Count == 0 )
Console.WriteLine("Asynchronous task logoff is completed.");
}
bool Logoff ( Session  session)

Logoff an interactive session.

Parameters
sessionInstance of the session retrieved from the server.

Example: Logoff all interactive sessions registered on the UserLock server."

UserLockServer userLockServer = new UserLockServer(".");
foreach (InteractiveSession userSession in userLockServer.InteractiveSessions)
{
Console.WriteLine("Closing session {0} of user {1}", userSession.UserName, userSession.SessionKeyName);
if (userLockServer.Logoff(userSession))
Console.WriteLine(userLockServer.Connection.LastMessage);
else
Console.WriteLine("Session successfully closed");
}
TaskAsync LogoffAsync ( List< Session sessions)

Logoffs interactive and IIS sessions in asynchronous way.

Parameters
sessionsSession instances retrieved from the server.

Example: Logoff all interactive sessions registered on the UserLock server. And query the asynchronous results.

UserLockServer userLockServer = new UserLockServer(".");
List<Session> sessions = userLockServer.AllSessions.FindAll(delegate(Session ses)
{
return ses.SessionType == SessionType.Interactive;
});
UserLockServer.TaskAsync taskAsync = userLockServer.LogoffAsync(sessions);
if (taskAsync != null)
{
// loop to query asynchronous results
int results = 0;
while (results < sessions.Count)
{
List<UserLockServer.TaskAsyncResult> parcial_results = userLockServer.QueryStateAsyncTask(ref taskAsync);
if (parcial_results == null) return;
if (parcial_results.Count > 0)
{
// loop the results
foreach (UserLockServer.TaskAsyncResult result in parcial_results)
{
if (result.State)
Console.WriteLine("Succeeded to logoff the \"{0}\" session.", result.Key);
else
Console.WriteLine("Failed to logoff the \"{0}\" session, reason: \"{1}\".", result.Key, result.Details);
}
results += parcial_results.Count;
// wait to the next query
if(results < sessions.Count)
{
if(parcial_results.Count == 1)
Thread.Sleep(2000);
else
Thread.Sleep(1000);
}
}
else if (results < sessions.Count) // wait to the next query
Thread.Sleep(3000);
}
// check there is no more results
if( userLockServer.QueryStateAsyncTask(ref _taskAsync).Count == 0 )
Console.WriteLine("Asynchronous task logoff is completed.");
}
bool LogoffIis ( string  session)

Logoff a IIS session.

Parameters
sessionKeyName of the session.

Example: Logoff a IIS session on the machine SERVER, for APPPOOL application pool and with 1 as terminal session number."

UserLockServer userLockServer = new UserLockServer(".");
if (!userLockServer.Logoff("SERVER/APPPOOL/1"))
Console.WriteLine("Failed to logoff the session. Error: {0}\n", userLockServer.Connection.LastMessage);
bool LogoffIis ( IisSession  session)

Logoff a IIS session.

Parameters
sessionInstance of the session retrieved from the server.

Example: Logoff all IIS sessions registered on the UserLock server."

UserLockServer userLockServer = new UserLockServer(".");
foreach (IisSession userSession in userLockServer.IisSessions)
{
Console.WriteLine("Closing session {0} of user {1}", userSession.Name, userSession.KeyName);
if (userLockServer.Logoff(userSession))
Console.WriteLine(userLockServer.Connection.LastMessage);
else
Console.WriteLine("Session successfully closed");
}
bool Lock ( string  session)

Lock an interactive session by specifying the session name.

Parameters
sessionName of the session.

Example: Lock an interactive session on the machine COMPUTER and with 1 as terminal session number."

UserLockServer userLockServer = new UserLockServer(".");
if (!userLockServer.Lock("COMPUTER/1"))
Console.WriteLine("Failed to lock the session. Error: {0}\n", userLockServer.Connection.LastMessage);
TaskAsync LockAsync ( string[]  sessions)

Locks interactive sessions in asynchronous way.

Parameters
sessionsName of the sessions.

Example: see LogoffAsync method.

bool Lock ( Session  session)

Lock an interactive session.

Parameters
sessionSession instance previously retrieved from the server.

Example: Lock all interactive sessions registered on the UserLock server."

UserLockServer userLockServer = new UserLockServer(".");
foreach (InteractiveSession userSession in userLockServer.InteractiveSessions)
if (!userSession.IsLockedOrDisconnected)
{
Console.WriteLine("Locking session {0} of user {1}", userSession.UserName, userSession.SessionKeyName);
if (userLockServer.Lock(userSession))
Console.WriteLine(userLockServer.Connection.LastMessage);
else
Console.WriteLine("Session successfully locked");
}
TaskAsync LockAsync ( List< Session sessions)

Locks interactive sessions in asynchronous way.

Parameters
sessionsSession instances previously retrieved from the server.

Example: see LogoffAsync(List<Session>) method.

bool Reset ( string  session)

Reset an interactive session.

Parameters
sessionName of the session.

Example: Reset an interactive session on the machine COMPUTER and with 1 as terminal session number."

UserLockServer userLockServer = new UserLockServer(".");
if (!userLockServer.Reset("COMPUTER/1"))
Console.WriteLine("Failed to reset the session. Error: {0}\n", userLockServer.Connection.LastMessage);
bool ResetRas ( string  session)

Reset a RAS session.

Parameters
sessionName of the session.

Example: Reset a RAS session on the server RASSERVER and with 1 as session number."

UserLockServer userLockServer = new UserLockServer(".");
if (!userLockServer.Reset("RASSERVER/1"))
Console.WriteLine("Failed to reset the session. Error: {0}\n", userLockServer.Connection.LastMessage);
bool ResetIis ( string  session)

Reset a IIS session.

Parameters
sessionName of the session.

Example: Reset a IIS session on the server IISSERVER and with 1 as session number."

UserLockServer userLockServer = new UserLockServer(".");
if (!userLockServer.Reset("IISSERVER/1"))
Console.WriteLine("Failed to reset the session. Error: {0}\n", userLockServer.Connection.LastMessage);
bool Reset ( Session  session)

Reset a session with a Session instance retrieved from the server.

Parameters
sessionInstance of the session retrieved from the server.
TaskAsync ResetAsync ( List< Session sessions)

Reset sessions with several Session instances retrieved from the server, in asynchronous way.

Parameters
sessionsSession instances retrieved from the server.

Example: Reset all sessions, in asynchronous way. And query the asynchronous results.

UserLockServer userLockServer = new UserLockServer(".");
UserLockServer.TaskAsync taskAsync = userLockServer.ResetAsync(userLockServer.AllSessions);
if (taskAsync != null)
{
// loop to query asynchronous results
int results = 0;
while (results < sessions.Count)
{
List<UserLockServer.TaskAsyncResult> parcial_results = userLockServer.QueryStateAsyncTask(ref taskAsync);
if (parcial_results == null) return;
if (parcial_results.Count > 0)
{
// loop the results
foreach (UserLockServer.TaskAsyncResult result in parcial_results)
{
if (result.State)
Console.WriteLine("Succeeded reset session \"{0}\".", result.Key);
else
Console.WriteLine("Failed reset session \"{0}\", reason: \"{1}\".", result.Key, result.Details);
}
results += parcial_results.Count;
// wait to the next query
if(results < sessions.Count)
{
if(parcial_results.Count == 1)
Thread.Sleep(2000);
else
Thread.Sleep(1000);
}
}
else if (results < sessions.Count) // wait to the next query
Thread.Sleep(3000);
}
// check there is no more results
if( userLockServer.QueryStateAsyncTask(ref _taskAsync).Count == 0 )
Console.WriteLine("Asynchronous task install agent is completed.");
}
bool SendPopup ( string  session,
string  message 
)

Overloaded function to send a popup to an interactive session. See the full version SendPopup(string, string, string) method.

TaskAsync SendPopupAsync ( string[]  sessions,
string  message 
)

Overloaded function to send a popup to several interactive sessions in asynchronous way. See the full version SendPopupAsync(string[], string, string) method.

bool SendPopup ( string  session,
string  message,
string  title 
)

Send a popup to an interactive session.

Parameters
sessionName of the session.
messageMessage to display to the user.
titleOptional title for the popup. If empty by default "Notification".

Example: Send a popup to the session 1 on the workstation COMPUTER.

UserLockServer userLockServer = new UserLockServer(".");
if (!userLockServer.SendPopup("COMPUTER/1", "How are you?", "Hello"))
Console.WriteLine("Failed to send the popup. Error: {0}\n", userLockServer.Connection.LastMessage);
TaskAsync SendPopupAsync ( string[]  sessions,
string  message,
string  title 
)

Sends a popup to several interactive sessions in asynchronous way.

Parameters
sessionsName of the sessions.
messageMessage to display to the user.
titleOptional title for the popup. If empty by default "Notification".

Example: see LogoffAsync method.

bool SendPopup ( Session  session,
string  message 
)

Overloaded function to shutdown a computer by specifying a Session instance retrieved from the UserLock server. See the full version SendPopup(Session, string, string) method.

TaskAsync SendPopupAsync ( List< Session sessions,
string  message 
)

Overloaded function to send a popup to several interactive sessions retrieved from the UserLock server, in asynchronous way. See the full version SendPopupAsync(List<Session>, string, string) method.

bool SendPopup ( Session  session,
string  message,
string  title 
)

Send a popup to an interactive session with a Session instance retrieved from the server.

Parameters
sessionInstance of the session retrieved from the server.
messageMessage to display to the user.
titleOptional title for the popup. If empty by default "Notification".
TaskAsync SendPopupAsync ( List< Session sessions,
string  message,
string  title 
)

Sends a popup to several interactive sessions in asynchronous way.

Parameters
sessionsSession instances previously retrieved from the server.
messageMessage to display to the user.
titleOptional title for the popup. If empty by default "Notification".

Example: see LogoffAsync(List<Session>) method.

void SendPopupToUser ( string  userName,
string  message 
)

Overloaded function to send a popup in all sessions of a specific user. See the full version SendPopupToUser(string, string, string) method.

TaskAsync SendPopupAsyncToUsers ( string[]  userNames,
string  message 
)

Overloaded function to send a popup in all sessions of several specific users in asynchronous way. See the full version SendPopupAsyncToUsers(string[], string, string) method.

void SendPopupToUser ( string  userName,
string  message,
string  title 
)

Send a popup in all sessions of a specific user.

Parameters
userNameUser account name
messageMessage to display to the user.
titleOptional title for the popup. If empty by default "Notification".
TaskAsync SendPopupAsyncToUsers ( string[]  userNames,
string  message,
string  title 
)

Send a popup in all sessions of several specific users in asynchronous way.

Parameters
userNamesUser account names.
messageMessage to display to the users.
titleOptional title for the popup. If empty by default "Notification".

Example: see LogoffAsync method.

void SendPopupToMachine ( string  machineName,
string  message 
)

Overloaded function to send a popup to all sessions on a specific machine. See the full version SendPopupToMachine(string, string, string) method.

TaskAsync SendPopupAsyncToMachines ( string[]  machineNames,
string  message 
)

Overloaded function to send a popup to all sessions on several specific machines in asynchronous way. See the full version SendPopupAsyncToMachines(string[], string, string) method.

void SendPopupToMachine ( string  machineName,
string  message,
string  title 
)

Send a popup to all sessions on a specific machine.

Parameters
machineNameComputer name
messageMessage to display to users.
titleOptional title for the popup. If empty by default "Notification".
TaskAsync SendPopupAsyncToMachines ( string[]  machineNames,
string  message,
string  title 
)

Send a popup to all sessions on several specific machines in asynchronous way.

Parameters
machineNamesComputer names.
messageMessage to display to users.
titleOptional title for the popup. If empty by default "Notification".

Example: see LogoffAsync method.

void SendPopupToGroup ( string  protectedGroupName,
string  message 
)

Overloaded function to send a popup to all members of a protected group or OU. See the full version SendPopupToGroup(string, string, string) method.

TaskAsync SendPopupAsyncToGroups ( string[]  protectedGroupNames,
string  message 
)

Overloaded function to send a popup to all members of several protected groups or OUs in asynchronous way. See the full version SendPopupAsyncToGroups(string[], string, string) method.

void SendPopupToGroup ( string  protectedGroupName,
string  message,
string  title 
)

Send a popup to all members of a protected group or OU.

Parameters
protectedGroupNameName of the group or distinguished name of the OU
messageMessage to display to users.
titleOptional title for the popup. If empty by default "Notification".
TaskAsync SendPopupAsyncToGroups ( string[]  protectedGroupNames,
string  message,
string  title 
)

Send a popup to all members of several protected groups or OUs in asynchronous way.

Parameters
protectedGroupNamesNames of the groups or distinguished names of the OUs.
messageMessage to display to users.
titleOptional title for the popup. If empty by default "Notification".

Example: see LogoffAsync method.

bool InstallAgent ( string  computer)

Install the agent for interactive sessions on a workstation or a terminal server.

Parameters
computerComputer name.

Example: Install the agent the workstation COMPUTER.

UserLockServer userLockServer = new UserLockServer(".");
if (!userLockServer.InstallAgent("COMPUTER"))
Console.WriteLine("Failed to install the agent. Error: {0}\n", userLockServer.Connection.LastMessage);
bool InstallRrasAgent ( string  computer)

Install the agent for RRAS sessions on a Microsoft RRAS server (deprecated).

Parameters
computerServer name.

Example: Install the agent the RRAS server RRASSERVER.

UserLockServer userLockServer = new UserLockServer(".");
if (!userLockServer.InstallRrasAgent("RRASSERVER"))
Console.WriteLine("Failed to install the RRAS agent. Error: {0}\n", userLockServer.Connection.LastMessage);
bool InstallIasAgent ( string  computer)

Install the agent for RADIUS sessions on a Microsoft NPS (IAS) server.

Parameters
computerServer name.

Example: Install the agent the NPS server on NPSSERVER.

UserLockServer userLockServer = new UserLockServer(".");
if (!userLockServer.InstallIasAgent("NPSSERVER"))
Console.WriteLine("Failed to install the NPS agent. Error: {0}\n", userLockServer.Connection.LastMessage);
bool InstallIisAgent ( string  computer)

Install the agent for IIS sessions on a Microsoft IIS server.

Parameters
computerServer name.

Example: Install the agent the IIS server IISSERVER.

UserLockServer userLockServer = new UserLockServer(".");
if (!userLockServer.InstallIasAgent("IISSERVER"))
Console.WriteLine("Failed to install the IIS agent. Error: {0}\n", userLockServer.Connection.LastMessage);
bool InstallAgent ( MachineState  machineState)

Install an agent with a MachineState instance retrieved from the server.

Parameters
machineStateMachineState instance retrieved from the server.
TaskAsync InstallAgentAsync ( List< MachineState machineStates)

Install multiple agents asynchronously, specifying MachineState instances retrieved from the UserLock server.

Parameters
machineStatesMachineState instances retrieved from the UserLock server.

Example: Install the agent in all machines that don't have it yet, asynchronously. And query the asynchronous results.

UserLockServer userLockServer = new UserLockServer(".");
UserLockServer.TaskAsync taskAsync = userLockServer.InstallAgentAsync(userLockServer.AgentDistributionWithoutAgent);
if (taskAsync != null)
{
// loop to query asynchronous results
int results = 0;
while (results < sessions.Count)
{
List<UserLockServer.TaskAsyncResult> parcial_results = userLockServer.QueryStateAsyncTask(ref taskAsync);
if (parcial_results == null) return;
if (parcial_results.Count > 0)
{
// loop the results
foreach (UserLockServer.TaskAsyncResult result in parcial_results)
{
if (result.State)
Console.WriteLine("Succeeded agent installation on computer \"{0}\".", result.Key);
else
Console.WriteLine("Failed agent installation on computer \"{0}\", reason: \"{1}\".", result.Key, result.Details);
}
results += parcial_results.Count;
// wait to the next query
if(results < sessions.Count)
{
if(parcial_results.Count == 1)
Thread.Sleep(2000);
else
Thread.Sleep(1000);
}
}
else if (results < sessions.Count) // wait to the next query
Thread.Sleep(3000);
}
// check there is no more results
if( userLockServer.QueryStateAsyncTask(ref _taskAsync).Count == 0 )
Console.WriteLine("Asynchronous task install agent is completed.");
}
bool UninstallAgent ( string  computer)

Uninstall the agent for interactive sessions from a workstation or a terminal server.

Parameters
computerComputer name.

Example: Uninstall the agent from the workstation COMPUTER.

UserLockServer userLockServer = new UserLockServer(".");
if (!userLockServer.UninstallAgent("COMPUTER"))
Console.WriteLine("Failed to uninstall the agent. Error: {0}\n", userLockServer.Connection.LastMessage);
bool UninstallRrasAgent ( string  computer)

Uninstall the agent for RRAS sessions from a Microsoft RRAS server (deprecated).

Parameters
computerServer name.

Example: Uninstall the agent from the server RRASSERVER.

UserLockServer userLockServer = new UserLockServer(".");
if (!userLockServer.UninstallAgent("RRASSERVER"))
Console.WriteLine("Failed to uninstall the agent. Error: {0}\n", userLockServer.Connection.LastMessage);
bool UninstallIasAgent ( string  computer)

Uninstall the agent for RADIUS sessions from a Microsoft IAS/NPS server.

Parameters
computerServer name.

Example: Uninstall the agent from the server IASSERVER.

UserLockServer userLockServer = new UserLockServer(".");
if (!userLockServer.UninstallAgent("IASSERVER"))
Console.WriteLine("Failed to uninstall the agent. Error: {0}\n", userLockServer.Connection.LastMessage);
bool UninstallIisAgent ( string  computer)

Uninstall the agent for IIS sessions from a Microsoft IIS server.

Parameters
computerServer name.

Example: Uninstall the agent from the server IISSERVER.

UserLockServer userLockServer = new UserLockServer(".");
if (!userLockServer.UninstallAgent("IISSERVER"))
Console.WriteLine("Failed to uninstall the agent. Error: {0}\n", userLockServer.Connection.LastMessage);
bool UninstallAgent ( MachineState  machineState)

Uninstall the agent by using a MachineState instance retrieved from the server.

Parameters
machineStateMachineState instance retrieved from the server.
TaskAsync UninstallAgentAsync ( List< MachineState machineStates)

Uninstall agents with several MachineState instances retrieved from the server, in asynchronous way.

Parameters
machineStatesMachineState instances retrieved from the server.

Example: see InstallAgentAsync method.

bool Reboot ( string  computer)

Reboot a computer.

Parameters
computerComputer name.

Example: Reboot the computer named COMPUTERNAME

UserLockServer userLockServer = new UserLockServer(".");
if (!userLockServer.Reboot("COMPUTERNAME"))
Console.WriteLine("Failed to reboot the computer. Error: {0}\n", userLockServer.Connection.LastMessage);
TaskAsync RebootAsync ( string[]  computers)

Reboots several computers in asynchronous way.

Parameters
computersComputer names.

Example: see LogoffAsync method.

bool Reboot ( MachineState  machineState)

Reboot a computer by specifying a MachineState instance retrieved from the UserLock server.

Parameters
machineStateMachineSate instance retrieved from the server.
TaskAsync RebootAsync ( List< MachineState machineStates)

Reboot multiple computers asynchronously, specifying MachineState instances retrieved from the UserLock server.

Parameters
machineStatesMachineSate instances retrieved from the UserLock server.

Example: see InstallAgentAsync method.

bool WakeUp ( string  computer)

Wakes up a computer.

Parameters
computerComputer name.

Example: Wake up the computer named COMPUTERNAME

UserLockServer userLockServer = new UserLockServer(".");
if (!userLockServer.WakeUp("COMPUTERNAME"))
Console.WriteLine("Failed to wake up the computer. Error: {0}\n", userLockServer.Connection.LastMessage);
TaskAsync WakeUpAsync ( string[]  computers)

Wakes up several computers in asynchronous way.

Parameters
computersComputer names.

Example: see LogoffAsync method.

bool WakeUp ( MachineState  machineState)

Wakes up a computer by specifying a MachineState instance retrieved from the UserLock server.

Parameters
machineStateMachineSate instance retrieved from the server.
TaskAsync WakeUpAsync ( List< MachineState machineStates)

Wake up multiple computers asynchronously, specifying MachineState instances retrieved from the UserLock server.

Parameters
machineStatesMachineSate instances retrieved from the server.

Example: see InstallAgentAsync method.

bool Shutdown ( string  computer)

Overloaded function to shutdown a computer. See the full version Shutdown(string, ExecutionMode, NotifyMode, double, ForceMode, string) method.

TaskAsync ShutdownAsync ( string[]  computers)

Overloaded function to shutdown several computers in asynchronous way. See the full version ShutdownAsync(string[], ExecutionMode, NotifyMode, double, ForceMode, string) method.

bool Shutdown ( string  computer,
ExecutionMode  executionMode,
ForceMode  forceMode,
string  message 
)

Overloaded function to shutdown a computer. See the full version Shutdown(string, ExecutionMode, NotifyMode, double, ForceMode, string) method.

TaskAsync ShutdownAsync ( string[]  computers,
ExecutionMode  executionMode,
ForceMode  forceMode,
string  message 
)

Overloaded function to shutdown several computers in asynchronous way. See the full version ShutdownAsync(string[], ExecutionMode, NotifyMode, double, ForceMode, string) method.

bool Shutdown ( string  computer,
double  timeOut,
string  message 
)

Overloaded function to shutdown a computer. See the full version Shutdown(string, ExecutionMode, NotifyMode, double, ForceMode, string) method.

TaskAsync ShutdownAsync ( string[]  computers,
double  timeOut,
string  message 
)

Overloaded function to shutdown several computers in asynchronous way. See the full version ShutdownAsync(string[], ExecutionMode, NotifyMode, double, ForceMode, string) method.

bool Shutdown ( string  computer,
ExecutionMode  executionMode,
NotifyMode  notifyMode,
double  timeOut,
ForceMode  forceMode,
string  message 
)

Shutdown a computer.

Parameters
computerComputer name.
executionModeExecution mode. See the enum ExecutionMode.
notifyModeNotify mode. See the enum NotifyMode
timeOutNotification timeout in minutes
forceModeForce applications to close. See the enum ForceMode
messageMessage to display to the user during the notification period

Example: Shutdown the computer named COMPUTERNAME. The shutdown will occur immediately if the computer is a workstation without logged on user or after a timeout of 2 minutes otherwise. If the user as opened documents that need to be saved the shutdown will not be forced.

UserLockServer userLockServer = new UserLockServer(".");
if (!userLockServer.Shutdown("COMPUTERNAME", ExecutionMode.ImmediateIfPossible, NotifyMode.ExecuteAfterTimeout, 2, ForceMode.No, "The computer will be powered off"))
Console.WriteLine("Failed to shutdown the computer. Error: {0}\n", userLockServer.Connection.LastMessage);
TaskAsync ShutdownAsync ( string[]  computers,
ExecutionMode  executionMode,
NotifyMode  notifyMode,
double  timeOut,
ForceMode  forceMode,
string  message 
)

Shutdowns several computers in asynchronous way.

Parameters
computersComputer names.
executionModeExecution mode. See the enum ExecutionMode.
notifyModeNotify mode. See the enum NotifyMode
timeOutNotification timeout in minutes
forceModeForce applications to close. See the enum ForceMode
messageMessage to display to the user during the notification period

Example: see LogoffAsync method.

bool Shutdown ( MachineState  machineState)

Shutdown a computer by specifying a MachineState instance retrieved from the UserLock server.

Parameters
machineStateMachineState instance retrieved from the UserLock server.
TaskAsync ShutdownAsync ( List< MachineState machineStates)

Overloaded function to shutdown several computers in asynchronous way, by specifying MachineState instances retrieved from the UserLock server. See the full version ShutdownAsync(List<MachineState>, ExecutionMode, NotifyMode, double, ForceMode, string) method.

Parameters
machineStatesList of MachineState instances retrieved from the UserLock server.
Returns
A ISDecisions.UserLockLibrary.UserLockServer.TaskAsync that represents this instance.
TaskAsync ShutdownAsync ( List< MachineState machineStates,
ExecutionMode  executionMode,
NotifyMode  notifyMode,
double  timeOut,
ForceMode  forceMode,
string  message 
)

Shut down multiple computers asynchronously, specifying MachineState instances retrieved from the UserLock server.

Parameters
machineStatesMachineState instances.
executionModeExecution mode. See the enum ExecutionMode.
notifyModeNotify mode. See the enum NotifyMode
timeOutNotification timeout in minutes
forceModeForce applications to close. See the enum ForceMode
messageMessage to display to the user during the notification period

Example: see InstallAgentAsync method.

string GetEnforceSync ( )

Enforce synchronization with the primary server. This command can only be sent to a backup server.

string GetEnforceSessionSync ( )

Enforce session synchronization with the primary server. This command can only be sent to a backup server.

bool CreateTable ( )

Create or recreate the UserLogonEvents table where is stored the logon history in the UserLock database.

Returns
True if the operation completed successfully and false otherwise.
bool CreateTimeIndex ( )

Creates an index on the EventTime field of the UserLogonEvents table to speed up queries on time frames

Returns
True if the operation completed successfully and false otherwise.
bool DeleteTimeIndex ( )

Deletes the index on the EventTime field of the UserLogonEvents table.

Returns
True if the operation completed successfully and false otherwise.
bool ExecuteSqlCommand ( string  command)

Executes an SQL command on the UserLock database.

Parameters
commandThe SQL command.
Returns
True if the operation completed successfully and false otherwise.
bool CompactDatabase ( )

Compacts the default UserLock database.

Returns
True if the operation completed successfully and False otherwise.
bool CleanOldLogons ( int  days)

Removes logon events older than a specific number of days from the logon history database

Parameters
daysThe event age limit in days
Returns
True if the operation completed successfully and False otherwise.
bool CleanOldLogons ( DateTime  limitDate)

Removes logon events older than a specific date from the logon history database.

Parameters
limitDateThe event date limit.
Returns
True if the operation completed successfully and False otherwise.
bool CleanAllLogons ( )

Clear all logon events the logon history database.

Returns
True if the operation completed successfully and False otherwise.
void UnblockAUser ( string  accountName)

Unblock a specific account with the provided user name

Parameters
accountNameAccount name which has to be unblocked
void BlockAUser ( string  accountName,
bool  createPermanentPA,
string  message,
bool  closeAllSessions 
)

Blocks a specific account with the provided user name (create the related protected account if it doesn't exist).

Parameters
accountNameAccount name which has to be blocked.
createPermanentPAIf set to true, creates a new permanent protected account related to the same user (only if there is no other existing permanent).
messageThe message to display when a blocked user opens a session.
closeAllSessionsIf set to true, all the opened sessions have to be closed after blocking. If the LogoffExceedingSessions property is enabled, this parameter will be considered as true, whatever its value is.
bool ExistingActiveTemporaryProtectedAccount ( string  protectedAccountName)

Return True if the provided account name has already an active temporary protected account

Parameters
protectedAccountNameProtected account name
Returns
True if the provided account name has already an active temporary protected account, otherwise false
void CloseAllSessionAfterBlocking ( string  protectedAccountName)

Close all the opened sessions of a protected account after this user has been blocked

Parameters
protectedAccountNameProtected account name of the protected account which has been blocked
static void UrlDecode ( ref String  sToDecode)
static

URL decode the parameter string according to the HTML URL Encoding Reference (https://www.w3schools.com/TAGS/ref_urlencode.asp).

Parameters
sToDecodeThe parameter string to URL decode in input, and the URL decoded string in output.
static void UrlEncode ( ref String  s,
bool  bEncodeSlash = true,
bool  bEncodeComma = false,
bool  bEncodePr100 = true,
bool  bEncodeColon = true,
bool  bEncodeBackS = true,
bool  bEncodeAster = true,
bool  bEncodeSemiC = true,
bool  bEncodeParLe = true,
bool  bEncodeParRi = true,
bool  bEncodeNewLi = true 
)
static

URL encode the parameter string according to the HTML URL Encoding Reference (https://www.w3schools.com/TAGS/ref_urlencode.asp).

Parameters
sThe parameter string to URL encode in input, and the URL encoded string in output.
bEncodeSlashIf set to true, all slash characters ('/') in the parameter string will be URL encoded. The default value is true.
bEncodeCommaIf set to true, all comma characters (',') in the parameter string will be URL encoded. The default value is false.
bEncodePr100If set to true, all percent characters ('') in the parameter string will be URL encoded. The default value is true.
bEncodeColonIf set to true, all colon characters (':') in the parameter string will be URL encoded. The default value is true.
bEncodeBackSIf set to true, all backslash characters ('\') in the parameter string will be URL encoded. The default value is true.
bEncodeAsterIf set to true, all asterisk characters ('*') in the parameter string will be URL encoded. The default value is true.
bEncodeSemiCIf set to true, all semicolon characters (';') in the parameter string will be URL encoded. The default value is true.
bEncodeParLeIf set to true, all left parenthesis characters ('(') in the parameter string will be URL encoded. The default value is true.
bEncodeParRiIf set to true, all left parenthesis characters (')') in the parameter string will be URL encoded. The default value is true.
bEncodeNewLiIf set to true, all new line characters ('
') in the parameter string will be URL encoded. The default value is true.
List<ReportedUser> GetOrphanedUsers ( )

Get all orphaned users.

Returns
A collection containing all orphaned users.
bool ResetMFAKey ( string  UserName)

Resets the MFA key for the provided user account name.

Parameters
UserNameUser account name.
Returns
true if reset was successful, false otherwise.
void DisableMFA ( string  accountName,
DateTime  startDate,
DateTime  endDate 
)

Disable MFA for the provided account name.

Parameters
accountNameAccount name.
startDateStart date of the temporary protected account.
endDateEnd date of the temporary protected account.
void DisableMFAAndResetMFAHelpMeStatus ( string  accountName,
DateTime  startDate,
DateTime  endDate 
)

Disable MFA and reset the MFA help me status for the provided account name.

Parameters
accountNameAccount name.
startDateStart date of the temporary protected account.
endDateEnd date of the temporary protected account.
TaskAsync RestartServiceAsync ( string  serviceName,
string  computerName = "." 
)

Restart service on computer

Parameters
serviceName
computerName
Returns
bool CanTestMfaUrl ( )

Checks if the MFA IIS URL is relative or not.

Returns
true if it is relative, false otherwise.
static string CombineUrl ( string  baseUrl,
string  pathToAdd 
)
static

Parameters
baseUrl
pathToAdd
Returns
bool TestMfaUrl ( out string  errorMessage,
string  publicUrl = "",
string  privateUrl = "" 
)

Tests the MFA URL.

Parameters
errorMessage[OUT] The error message if any.
publicUrl[IN] The public URL.
privateUrl[IN] The private URL.
Returns
True if successful, false otherwise.
IList<EnabledPolicies> GetEnabledPolicies ( )

Retrive a list of all enabled policies on the server.

Returns
InitialAccessPointPolicy GetInitialAccessPointPolicy ( string  paIdentifier)

Get the InitialAccessPointPolicy for paIdentifier

Parameters
paIdentifierThe account identifier.
Returns
The InitialAccessPointPolicy object, or null if don't exist
InitialAccessPointPolicy GetTemporaryInitialAccessPointPolicy ( string  accountName,
DateTime  startDate,
DateTime  endDate 
)

Get a temporary InitialAccessPointPolicy for accountName.

Parameters
accountNameThe account name
startDateThe start date
endDateThe end date
Returns
The InitialAccessPointPolicy object, or null if don't exist
bool AddInitialAccessPointPolicyToGroup ( string  groupName,
out InitialAccessPointPolicy  policyRet 
)

Add a initial access point policy to a group.

Parameters
groupNameThe group name
policyRetnull if failed, the created instance if succeeded
Returns
True if succeeded, false otherwhise
bool AddInitialAccessPointPolicyToGroup ( string  groupName)

Add a initial access point policy to a group.

Parameters
groupNameThe group name
Returns
True if succeeded, false otherwhise
bool AddInitialAccessPointPolicyToUser ( string  userName,
out InitialAccessPointPolicy  policyRet 
)

Add a initial access point policy to a User.

Parameters
userNameThe user name
policyRetnull if failed, the created instance if succeeded
Returns
True if succeeded, false otherwhise
bool AddInitialAccessPointPolicyToUser ( string  userName)

Add a initial access point policy to a User.

Parameters
userNameThe user name
Returns
True if succeeded, false otherwhise
bool AddInitialAccessPointPolicyToOu ( string  ouName,
out InitialAccessPointPolicy  policyRet 
)

Add a initial access point policy to a OU.

Parameters
ouNamethe ou name
policyRetnull if failed, the created instance if succeeded
Returns
True if succeeded, false otherwhise
bool AddInitialAccessPointPolicyToOu ( string  ouName)

Add a initial access point policy to a OU.

Parameters
ouNamethe ou name
Returns
True if succeeded, false otherwhise
bool AddTemporaryInitialAccessPointPolicyToOu ( string  accountName,
DateTime  startDate,
DateTime  endDate 
)

Add a temporary initial access point policy to a OU.

Parameters
accountNamethe ou name
startDatestart date
endDateend date
Returns
True if succeeded, false otherwhise
bool AddTemporaryInitialAccessPointPolicyToOu ( string  accountName,
DateTime  startDate,
DateTime  endDate,
out InitialAccessPointPolicy  policyRet 
)

Add a temporary initial access point policy to a OU.

Parameters
accountNamethe ou name
startDatestart date
endDateend date
policyRetnull if failed, the created instance if succeeded
Returns
True if succeeded, false otherwhise
bool AddTemporaryInitialAccessPointPolicyToGroup ( string  accountName,
DateTime  startDate,
DateTime  endDate 
)

Add a temporary initial access point policy to a Group.

Parameters
accountNamethe group name
startDatestart date
endDateend date
Returns
True if succeeded, false otherwhise
bool AddTemporaryInitialAccessPointPolicyToGroup ( string  accountName,
DateTime  startDate,
DateTime  endDate,
out InitialAccessPointPolicy  policyRet 
)

Add a temporary initial access point policy to a Group.

Parameters
accountNamethe group name
startDatestart date
endDateend date
policyRetnull if failed, the created instance if succeeded
Returns
True if succeeded, false otherwhise
bool AddTemporaryInitialAccessPointPolicyToUser ( string  accountName,
DateTime  startDate,
DateTime  endDate 
)

Add a temporary initial access point policy to a User.

Parameters
accountNamethe user name
startDatestart date
endDateend date
Returns
True if succeeded, false otherwhise
bool AddTemporaryInitialAccessPointPolicyToUser ( string  accountName,
DateTime  startDate,
DateTime  endDate,
out InitialAccessPointPolicy  policyRet 
)

Add a temporary initial access point policy to a User.

Parameters
accountNamethe user name
startDatestart date
endDateend date
policyRetnull if failed, the created instance if succeeded
Returns
True if succeeded, false otherwhise
SessionLimitPolicy GetSessionLimitPolicy ( string  paIdentifier)

Get the SessionLimitPolicy for paIdentifier

Parameters
paIdentifierThe account identifier.
Returns
The SessionLimitPolicy object, or null if don't exist
SessionLimitPolicy GetTemporarySessionLimitPolicy ( string  accountName,
DateTime  startDate,
DateTime  endDate 
)

Get a temporary SessionLimitPolicy for accountName.

Parameters
accountNameThe account name
startDateThe start date
endDateThe end date
Returns
The SessionLimitPolicy object, or null if don't exist
bool AddSessionLimitPolicyToGroup ( string  groupName,
out SessionLimitPolicy  policyRet 
)

Add a Session Limit policy to a group.

Parameters
groupNameThe group name
policyRetnull if failed, the created instance if succeeded
Returns
True if succeeded, false otherwhise
bool AddSessionLimitPolicyToGroup ( string  groupName)

Add a Session Limit policy to a group.

Parameters
groupNameThe group name
Returns
True if succeeded, false otherwhise
bool AddSessionLimitPolicyToUser ( string  userName,
out SessionLimitPolicy  policyRet 
)

Add a Session Limit policy to a User.

Parameters
userNameThe user name
policyRetnull if failed, the created instance if succeeded
Returns
True if succeeded, false otherwhise
bool AddSessionLimitPolicyToUser ( string  userName)

Add a Session Limit policy to a User.

Parameters
userNameThe user name
Returns
True if succeeded, false otherwhise
bool AddSessionLimitPolicyToOu ( string  ouName,
out SessionLimitPolicy  policyRet 
)

Add a Session Limit policy to a OU.

Parameters
ouNamethe ou name
policyRetnull if failed, the created instance if succeeded
Returns
True if succeeded, false otherwhise
bool AddSessionLimitPolicyToOu ( string  ouName)

Add a Session Limit policy to a OU.

Parameters
ouNamethe ou name
Returns
True if succeeded, false otherwhise
bool AddTemporarySessionLimitPolicyToOu ( string  accountName,
DateTime  startDate,
DateTime  endDate 
)

Add a temporary Session Limit policy to a OU.

Parameters
accountNamethe ou name
startDatestart date
endDateend date
Returns
True if succeeded, false otherwhise
bool AddTemporarySessionLimitPolicyToOu ( string  accountName,
DateTime  startDate,
DateTime  endDate,
out SessionLimitPolicy  policyRet 
)

Add a temporary Session Limit policy to a OU.

Parameters
accountNamethe ou name
startDatestart date
endDateend date
policyRetnull if failed, the created instance if succeeded
Returns
True if succeeded, false otherwhise
bool AddTemporarySessionLimitPolicyToGroup ( string  accountName,
DateTime  startDate,
DateTime  endDate 
)

Add a temporary Session Limit policy to a Group.

Parameters
accountNamethe group name
startDatestart date
endDateend date
Returns
True if succeeded, false otherwhise
bool AddTemporarySessionLimitPolicyToGroup ( string  accountName,
DateTime  startDate,
DateTime  endDate,
out SessionLimitPolicy  policyRet 
)

Add a temporary Session Limit policy to a Group.

Parameters
accountNamethe group name
startDatestart date
endDateend date
policyRetnull if failed, the created instance if succeeded
Returns
True if succeeded, false otherwhise
bool AddTemporarySessionLimitPolicyToUser ( string  accountName,
DateTime  startDate,
DateTime  endDate 
)

Add a temporary Session Limit policy to a User.

Parameters
accountNamethe user name
startDatestart date
endDateend date
Returns
True if succeeded, false otherwhise
bool AddTemporarySessionLimitPolicyToUser ( string  accountName,
DateTime  startDate,
DateTime  endDate,
out SessionLimitPolicy  policyRet 
)

Add a temporary Session Limit policy to a User.

Parameters
accountNamethe user name
startDatestart date
endDateend date
policyRetnull if failed, the created instance if succeeded
Returns
True if succeeded, false otherwhise
WorkstationPolicy GetWorkstationPolicy ( string  paIdentifier)

Get the WorkstationPolicy for paIdentifier

Parameters
paIdentifierThe account identifier.
Returns
The WorkstationPolicy object, or null if don't exist
WorkstationPolicy GetTemporaryWorkstationPolicy ( string  accountName,
DateTime  startDate,
DateTime  endDate 
)

Get a temporary WorkstationPolicy for accountName.

Parameters
accountNameThe account name
startDateThe start date
endDateThe end date
Returns
The WorkstationPolicy object, or null if don't exist
bool AddWorkstationPolicyToGroup ( string  groupName,
out WorkstationPolicy  policyRet 
)

Add a Workstation restrictions policy to a group.

Parameters
groupNameThe group name
policyRetnull if failed, the created instance if succeeded
Returns
True if succeeded, false otherwhise
bool AddWorkstationPolicyToGroup ( string  groupName)

Add a Workstation restrictions policy to a group.

Parameters
groupNameThe group name
Returns
True if succeeded, false otherwhise
bool AddWorkstationPolicyToUser ( string  userName,
out WorkstationPolicy  policyRet 
)

Add a Workstation restrictions policy to a User.

Parameters
userNameThe user name
policyRetnull if failed, the created instance if succeeded
Returns
True if succeeded, false otherwhise
bool AddWorkstationPolicyToUser ( string  userName)

Add a Workstation restrictions policy to a User.

Parameters
userNameThe user name
Returns
True if succeeded, false otherwhise
bool AddWorkstationPolicyToOu ( string  ouName,
out WorkstationPolicy  policyRet 
)

Add a Workstation restrictions policy to a OU.

Parameters
ouNamethe ou name
policyRetnull if failed, the created instance if succeeded
Returns
True if succeeded, false otherwhise
bool AddWorkstationPolicyToOu ( string  ouName)

Add a Workstation restrictions policy to a OU.

Parameters
ouNamethe ou name
Returns
True if succeeded, false otherwhise
bool AddTemporaryWorkstationPolicyToOu ( string  accountName,
DateTime  startDate,
DateTime  endDate 
)

Add a temporary Workstation restrictions policy to a OU.

Parameters
accountNamethe ou name
startDatestart date
endDateend date
Returns
True if succeeded, false otherwhise
bool AddTemporaryWorkstationPolicyToOu ( string  accountName,
DateTime  startDate,
DateTime  endDate,
out WorkstationPolicy  policyRet 
)

Add a temporary Workstation restrictions policy to a OU.

Parameters
accountNamethe ou name
startDatestart date
endDateend date
policyRetnull if failed, the created instance if succeeded
Returns
True if succeeded, false otherwhise
bool AddTemporaryWorkstationPolicyToGroup ( string  accountName,
DateTime  startDate,
DateTime  endDate 
)

Add a temporary Workstation restrictions policy to a Group.

Parameters
accountNamethe group name
startDatestart date
endDateend date
Returns
True if succeeded, false otherwhise
bool AddTemporaryWorkstationPolicyToGroup ( string  accountName,
DateTime  startDate,
DateTime  endDate,
out WorkstationPolicy  policyRet 
)

Add a temporary Workstation restrictions policy to a Group.

Parameters
accountNamethe group name
startDatestart date
endDateend date
policyRetnull if failed, the created instance if succeeded
Returns
True if succeeded, false otherwhise
bool AddTemporaryWorkstationPolicyToUser ( string  accountName,
DateTime  startDate,
DateTime  endDate 
)

Add a temporary Workstation restrictions policy to a User.

Parameters
accountNamethe user name
startDatestart date
endDateend date
Returns
True if succeeded, false otherwhise
bool AddTemporaryWorkstationPolicyToUser ( string  accountName,
DateTime  startDate,
DateTime  endDate,
out WorkstationPolicy  policyRet 
)

Add a temporary Workstation restrictions policy to a User.

Parameters
accountNamethe user name
startDatestart date
endDateend date
policyRetnull if failed, the created instance if succeeded
Returns
True if succeeded, false otherwhise

Property Documentation

ClientServerCompatibility ServerCompatibility
getset

Compatibility between the client and the server.

Version ClientCommandSetVersion
get

The version of the command set of the client.

Version ServerCommandSetVersion
getset

The version of the command set of the server.

string UserName
getset

The username.

string DomainName
getset

The domain name.

string Password
getset

The password.

Exception ConnectionException
get

Get the last exception generated by the client/server communication. See the example in the constructor of the class UserLockServer.

string ServerName
getset

Get or set the address of the UserLock server. Specify a dot (.) for a local server.

string ServerAddress
get

Get the address of the UserLock server. A null value is returned for a local server

string LocalMachineName
staticget

Get the name of the local machine the UserLock API is running on

string DisplayName
get

Get the display name (NetBIOS name) of the UserLock server.

string ServiceVersion
get

Get the version of the UserLock service.

string UserLockServerDomainName
get

Get the domain name (NetBIOS name) of the UserLock server.

System.Collections.Specialized.StringDictionary IllegitimateServerNames
get

The illegitimate server names.

ServerMode ServerType
get

Get the server type. See the enum ServerMode for more information.

string BackupServer
get

The name of the backup server, if any.

string ConnectionStringWithoutPassword
get

Get the connection string to the database used by the UserLock server for the logon history.

ServerProperties Properties
get

Get the server properties. See the ServerProperties class for more information.

The min and max session counts.

Get the license status for the UserLock server. See the enum LicenseStatus for all possible values.

Use of the license. See the LicenseUseStatus enum for all possible values.

bool IsSmtpConfigured
get

true if E-mail settings for notifications are configured, false otherwise.

bool AdminCredentialsStatus
get

true if the credentials of the impersonation account are valid, false otherwise.

Get the list of all protected accounts configured on the UserLock server.

Example: List all protected accounts on the UserLock server

UserLockServer userLockServer = new UserLockServer(".")
foreach (ProtectedAccount protectedAccount in userLockServer.ProtectedAccounts)
Console.WriteLine("Name: {0,15} Type: {1,10} Allowed interactive sessions: {2,4}",
protectedAccount.AccountName, protectedAccount.Type, protectedAccount.NbConcurrentLogins);

Get the list of all customizable message from the UserLock server

UserLockServer userLockServer = new UserLockServer(".")
foreach (Message message in userLockServer.Messages)
Console.WriteLine("Message {0} = {1}", message.MessageId, message.Value);
ReportedUserSessions UserSessions
get

Interactive user sessions.

ReportedUserSessions AllUserSessions
get

All user sessions.

ReportedUserSessions UserSessionsWithSessionOnly
get

Users with sessions.

ReportedUserSessions UserSessionsActiveSessionsOnly
get

Active user sessions (not locked and not disconnected).

ReportedUserSessions UserSessionsWithMoreOneSessionOnly
get

Users with more than one session.

ReportedUserSessions UserSessionsComputerUnavailableOnly
get

Users with orphaned sessions (sessions on unreachable computers).

ReportedUserSessions UserSessionsLockedSessionsOnly
get

Locked user sessions.

ReportedUserSessions UserSessionsWorkstationSessionsOnly
get

workstation user sessions.

ReportedUserSessions UserSessionsTerminalSessionsOnly
get

terminal user sessions.

ReportedUserSessions UserSessionsIisSessionsOnly
get

iis user sessions.

ReportedUserSessions UserSessionsVpnSessionsOnly
get

vpn user sessions.

ReportedUserSessions UserSessionsWifiSessionsOnly
get

wifi user sessions.

ReportedUserSessions UserSessionsSaasSessionsOnly
get

saas user sessions.

ReportedUserSessions UserSessionsWithActiveUser
get

user sessions with active user.

ReportedUserSessions UserSessionsWithProtectedUser
get

user sessions with protected user.

ReportedUserSessions UserSessionsWithUnprotectedUser
get

user sessions with unprotected user.

ReportedUserSessions UserSessionsWithHighRiskUser
get

user sessions with high risk user.

ReportedUserSessions UserSessionsWithRiskUser
get

user sessions with risk user.

ReportedUserSessions UserSessionsWithNewUser
get

user sessions with new user.

ReportedUserSessions UserSessionsWithInactiveUser
get

user sessions with inactive user.

ReportedUserSessions UserSessionsWithOneSessionOnly
get

user sessions with inactive user.

ReportedMachineSessions MachineSessions
get

All machine sessions.

ReportedMachineSessions MachineSessionsWithSessionOnly
get

Machines with sessions.

ReportedMachineSessions MachineSessionsActiveSessionsOnly
get

Active machine sessions (not locked and not disconnected).

ReportedMachineSessions MachineSessionsComputerUnavailableOnly
get

Machines with orphaned sessions (sessions on unreachable computers).

ReportedMachineSessions MachineSessionsWithMoreOneSessionOnly
get

Machines with more than one session.

ReportedMachineSessions MachineSessionsWithOneSessionOnly
get

Machines with only one session.

ReportedRasSessions RasUserSessions
get

Wi-Fi / VPN (RAS) user sessions.

List<ReportedUser> ReportedUsers
get

List of users with the list of interactive sessions for each. See the class ReportedUser.

List<ReportedUser> AllReportedUsers
get

List of users with the list of all kind of sessions for each. See the class ReportedUser.

List<ReportedUser> ReportedUsersWithMoreThanOneSession
get

List of users with more than one session.

List<ReportedUser> ActiveReportedUsers
get

List of users with an active status (protected + unprotected). See the enum UserStatus.

List<ReportedUser> ProtectedReportedUsers
get

List of users with an protected status. See the enum UserStatus.

List<ReportedUser> UnprotectedReportedUsers
get

List of users with an unprotected status. See the enum UserStatus.

List<ReportedUser> HighRiskReportedUsers
get

List of users with an high risk status. See the enum UserStatus.

List<ReportedUser> RiskReportedUsers
get

List of users with a risk status. See the enum UserStatus.

List<ReportedUser> NewReportedUsers
get

List of users with a new status. See the enum UserStatus.

List<ReportedUser> InactiveReportedUsers
get

List of users with an inactive status. See the enum UserStatus.

List<ReportedUser> ReportedUsersWithOneSessionOnly
get

List of users with only one session.

List<Session> AllSessions
get

Get all sessions from any kind

List<InteractiveSession> InteractiveSessions
get

Get all interactive sessions.

Example: Send a popup to all opened interactive sessions

UserLockServer userLockServer = new UserLockServer(".")
foreach (Session session in userLockServer.InteractiveSessions)
userLockServer.SendPopup(session, "Warning, something is going on!", "Alert");
List<RasSession> RasSessions
get

Get the list of Wi-Fi / VPN sessions. See the class RasSession.

List<IisSession> IisSessions
get

Get the list of IIS sessions. See the class IisSession.

List<ReportedMachine> ReportedMachines
get

Get the list of computers with the list of interactive sessions on each computer. See the class ReportedMachine.

List<ReportedMachine> ReportedMachinesSimple
get

List of workstations with only the number of sessions on each workstation. User and session information is not provided. This is a public command. Anyone can get this information.

Example: Power off all workstations without any session on them

UserLockServer userLockServer = new UserLockServer(".")
ReportedMachines reportedWorkstations = userLockServer.ReportedMachinesSimple;
foreach (ReportedMachine reportedWorkstation in reportedWorkstations)
if (reportedWorkstation.SessionCount == 0)
userLockServer.Shutdown(reportedWorkstation.MachineName, ExecutionMode.ImmediateIfPossible, NotifyMode.PopupPeriod, 5, ForceMode.No, "This workstation will be powered off");
List<ReportedMachine> ReportedMachinesSimpleEx
get

List of workstations with the number of sessions on each workstation, and optionally the username. User and session information is optionally provided. This is a public command. Anyone can get this information.

Machines MachineDistribution
get

Get the all machines with all agent inside of the protected network zone.

Machines MachineDistributionAll
get

Get all machines inside of the protected network zone. See the class Machines.

Machines MachineDistributionDCOnly
get

Get Domain Controller machines inside of the protected network zone. See the class Machines.

Machines MachineDistributionRRASOnly
get

Get RRAS machines inside of the protected network zone. See the class Machines.

Machines MachineDistributionNPSOnly
get

Get NPS machines inside of the protected network zone. See the class Machines.

Machines MachineDistributionIISOnly
get

Get IIS machines inside of the protected network zone. See the class Machines.

Machines MachineDistributionUnavailable
get

Get Unavailable machines inside of the protected network zone. See the class Machines.

Machines MachineDistributionWithoutAgent
get

Get machines without agent inside of the protected network zone. See the class Machines.

Machines MachineDistributionMACOnly
get

Get Mac machines inside of the protected network zone. See the class Machines.

Machines MachineDistributionWithAgent
get

Get machines with agent inside of the protected network zone. See the class Machines.

Machines MachineDistributionWorkstation
get

Get Workstation machines inside of the protected network zone. See the class Machines.

Machines MachineDistributionServer
get

Get Server machines inside of the protected network zone. See the class Machines.

Machines MachineDistributionDesktop
get

Get machines, inside of the protected network zone, where agent desktop can be installed. See the class Machines.

MachineStates AgentDistribution
get

Get the agent status for all machines of the protected network zone.

MachineStates AgentDistributionWithoutAgent
get

Get the agent status for all machines of the protected network zone without the agent installed.

Example: Install the desktop agent on any workstation without the agent

UserLockServer userLockServer = new UserLockServer(".");
foreach (MachineState machineState in userLockServer.AgentDistributionWithoutAgent)
if (machineState.IsWorkstation)
userLockServer.InstallAgent(machineState);
MachineStates AgentDistributionUnavailable
get

Get the agent status for all unavailable machines of the protected network zone.

Get the agent distribution properties of the UserLock server. See the class AgentDistributionProperties for more information.

Example: Start the automatic deployment mode

UserLockServer userLockServer = new UserLockServer(".");
AgentDistributionProperties agentDistributionProperties = userLockServer.AgentDistributionProperties;
agentDistributionProperties.DeployMode = true; // The agent will be installed
agentDistributionProperties.AutoMode = true; // The automatic deployment mode is enabled
agentDistributionProperties.SetInfo(AgentDistributionProperties.PropertyList.Deployer); // Upload deployer properties
MachineStates AgentDistributionDCOnly
get

Agent status for all domain controllers in the protected network zone.

MachineStates AgentDistributionMacOnly
get

Agent status for all macOS computers in the protected network zone.

int TotalSessionCount
get

The total number of sessions.

int TotalUserCount
get

The total number of users.

int CurrentNumberLicencesConsumed
get

The current number of licenses consumed.

int NumberLicencesConsumedOneYearMax
get

The probable number of licenses that could be consumed after one year of use of the software if you only protect Interactive sessions (twice the number of Desktop UserLock agents installed). This number is not realistic if you are protecting IIS, Wi-Fi, or VPN sessions.

int NumberLicencesConsumedOneYearProbablyInteractive
get

The probable number of licenses that could be consumed after one year of use of the software if you only protect Interactive sessions (twice the number of Desktop UserLock agents installed). This number is not realistic if you are protecting IIS, Wi-Fi, or VPN sessions.

int MaxSessionCount
get

This property is obsolete. Use MaxNumberConsumableLicences instead.

int MaxNumberConsumableLicences
get

The maximum number of consumable licenses.

bool IsSubscription
get

The licensing mode, true if subscriptive.

bool IsByUser
get

The licensing mode, true if by users.

Get set the session statistic mode. See the enum SessionStatisticMode.

Statistic [] SessionStatistics
get

Get session statistics (Session break down Orphaned/Locked Interactive/Active Interactive/RAS/IIS). See also the class Statistic.

Statistic [] UserStatistics
get

Get user statistics (0 session/1 session/More than 1 session). See also the class Statistic.

Statistic [] UserStatusStatistics
get

Get user status statistics (high risk/risk/new/inactive/protected/unprotected). See also the class Statistic.

Statistic [] MachineStatistics
get

Get machine statistics (0 session/1 session/> 1 session). See also the class Statistic.

Statistic [] AgentDistributionStatistics
get

Get agent statistic (Not Installed/Installed/Unknown/Installing/Uninstalling/Upgrading). See also the class Statistic.

Statistic [] AgentTypeStatistics
get

Agent type statistics (Desktop, DC, NPS, IIS, RRAS (deprecated)). See also the Statistic class.

Statistic [] MachineStateStatistics
get

Get ServerLevel statistic (DC/IAS/IIS/RRAS(deprecated)....). See also the class Statistic.

Statistic [] ProtectedAccountStatistics
get

Get Protected account statistic (OU / Groups / Users). See also the class Statistic.

HashSet<String> MfaNeedHelpUserList
get

Get the list of users needing help for mfa.

Statistic [] MachineEnvironmentStatistics
get

Get Machine Environment statistics. See also the class Statistic.

Statistic [] UserEnvironmentStatistics
get

Get User Environment statistics. See also the class Statistic.

Statistic [] MonitoringSessionsStatistics
get

Get monitoring sessions statistics. See also the class Statistic.

Statistic [] MonitoringUserSessionsStatistics
get

Get monitoring user sessions statistics. See also the class Statistic.

Statistic [] MonitoringMachineSessionsStatistics
get

Get monitoring machine sessions statistics. See also the class Statistic.

bool Connected
get

True if the instance of UserLockServer is connected to a UserLock server. False otherwise.