ServiceManagementModuleMBS methods

Online Documentation   -   Statistics   -   FAQ   -   Plugin Parts (All, Dependencies)   -   Class hierarchy

New in Version 22.2 22.3 22.4 22.5 23.0 23.1 23.2 23.3 23.4 23.5 24.0 24.1

The list of the   topics,   classes,   interfaces,   controls,   modules,   global methods by category,   global methods by name,   screenshots,   licenses   and   examples.

Platforms to show: All Mac Windows Linux Cross-Platform

Back to ServiceManagementModuleMBS module.

ServiceManagementModuleMBS.AllJobDictionaries(domain as string) as Dictionary()

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Login Items MBS MacCF Plugin 14.2 ✅ Yes ❌ No ❌ No ❌ No Desktop only
Returns the job description dictionaries for all jobs in the given domain.

domain: The desired domain (e.g. kSMDomainSystemLaunchd).

Returns a new array containing all job dictionaries, or empty array if an error occurred. Must be released by the caller.
Available in OS X v10.6 and later.

ServiceManagementModuleMBS.CreateAuthorization as AuthorizationMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Login Items MBS MacCF Plugin 14.2 ✅ Yes ❌ No ❌ No ❌ No Desktop only
Creates an authorization for Job operations.

Creates an authorization with kSMRightBlessPrivilegedHelper and flags InteractionAllowed, PreAuthorize and ExtendRights.

Some examples using this method:

ServiceManagementModuleMBS.JobBless(domain as string, executableLabel as string, auth as AuthorizationMBS, byref error as Variant) as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Login Items MBS MacCF Plugin 14.2 ✅ Yes ❌ No ❌ No ❌ No Desktop only
Submits the executable for the given label as a launchd job.

domain: The job's domain. Only kSMDomainSystemLaunchd is supported.
executableLabel: The label of the privileged executable to install. This label must be one of the keys found in the SMPrivilegedExecutables dictionary in the application's Info.plist.
auth: An authorization reference containing the kSMRightBlessPrivilegedHelper right.
Error: An output reference to a CFErrorMBS describing the specific error encountered while submitting the executable tool, or nil if successful. It is the responsibility of the application to release the error reference.

Returns true if the job was successfully submitted, otherwise false.

JobBless submits the executable for the given label as a launchd job. This function obviates the need for a setuid helper invoked via AuthorizationExecuteWithPrivileges in order to install a launchd plist.

If the job is already installed, success is returned.

In order to use this function the following requirements must be met:


Each key of SMPrivilegedExecutables is a reverse-DNS label for the helper tool (must be globally unique).


Available in OS X v10.6 and later.

Some examples using this method:

ServiceManagementModuleMBS.JobDictionary(domain as string, jobLabel as string) as Dictionary

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Login Items MBS MacCF Plugin 14.2 ✅ Yes ❌ No ❌ No ❌ No Desktop only
Returns the job description dictionary for the given job label.

domain: The job's domain (e.g. kSMDomainSystemLaunchd).
jobLabel: The label identifier for the job to copy.

Return a new dictionary describing the job, or nil if the job could not be found.
Available in OS X v10.6 and later.

ServiceManagementModuleMBS.JobRemove(domain as string, jobLabel as string, auth as AuthorizationMBS, wait as boolean, byref error as CFErrorMBS) as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Login Items MBS MacCF Plugin 14.2 ✅ Yes ❌ No ❌ No ❌ No Desktop only
Removes the job with the given label from the specified domain.

domain: The job's domain (e.g. kSMDomainSystemLaunchd).
jobLabel: The label for the job to remove.
auth: An AuthorizationRef containing the kSMRightModifySystemDaemons right if the given domain is kSMDomainSystemLaunchd.
wait: Pass true to block until the process for the given job has exited.
Error: An output reference to a CFErrorMBS describing the specific error encountered while submitting the job dictionary, or nil if no error occurred. It is the responsibility of the application to release the error reference.

Returns true if the job was removed successfully, otherwise false.

JobSubmit removes the job specified by label from the domain. If the job is currently running, it will conditionally block until the running process has exited.
Available in OS X v10.6 and later.

ServiceManagementModuleMBS.JobSubmit(domain as string, job as Dictionary, auth as AuthorizationMBS, byref error as CFErrorMBS) as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Login Items MBS MacCF Plugin 14.2 ✅ Yes ❌ No ❌ No ❌ No Desktop only
Submits the given job to the specified domain.

domain: The job's domain (e.g. kSMDomainSystemLaunchd).
job: A dictionary describing a job.
auth: An AuthorizationRef containing the kSMRightModifySystemDaemons right if the given domain is kSMDomainSystemLaunchd.
Error: An output reference to a CFErrorMBS describing the specific error encountered while submitting the job dictionary, or NULL if no error occurred. It is the responsibility of the application to release the error reference.

Returns true if the job was submitted successfully, otherwise false.

JobSubmit submits the given job to the specified domain.
Available in OS X v10.6 and later.

ServiceManagementModuleMBS.kSMDomainSystemLaunchd as string

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Login Items MBS MacCF Plugin 14.2 ✅ Yes ❌ No ❌ No ❌ No Desktop only
System-level launchd domain.

Some examples using this method:

ServiceManagementModuleMBS.kSMDomainUserLaunchd as string

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Login Items MBS MacCF Plugin 14.2 ✅ Yes ❌ No ❌ No ❌ No Desktop only
User-level launchd domain.

ServiceManagementModuleMBS.kSMInfoKeyAuthorizedClients as string

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Login Items MBS MacCF Plugin 14.2 ✅ Yes ❌ No ❌ No ❌ No Desktop only
Authorized clients property list key.

ServiceManagementModuleMBS.kSMInfoKeyPrivilegedExecutables as string

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Login Items MBS MacCF Plugin 14.2 ✅ Yes ❌ No ❌ No ❌ No Desktop only
Privileged executables property list key.

ServiceManagementModuleMBS.LoginItemRunning(identifier as string) as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Login Items MBS MacCF Plugin 12.3 ✅ Yes ❌ No ❌ No ❌ No Desktop only
Checks whether a login item is running.

Actually checks if there is a record for your helper, so if it crashed, this returns still true.

Some examples using this method:

ServiceManagementModuleMBS.LoginItemSetEnabled(identifier as string, enabled as boolean) as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Login Items MBS MacCF Plugin 12.3 ✅ Yes ❌ No ❌ No ❌ No Desktop only
Enable a helper application located in the main application bundle's Contents/Library/LoginItems directory.

identifier: The bundle identifier of the helper application bundle.
enabled: The Boolean enabled state of the helper application. This value is effective only for the currently logged in user. If true, the helper application will be started immediately (and upon subsequent logins) and kept running. If false, the helper application will no longer be kept running.

Returns true if the requested change has taken effect.

Some examples using this method:

ServiceManagementModuleMBS.RegisterHelperApp(name as string, Update as boolean = false) as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Login Items MBS MacCF Plugin 12.3 ✅ Yes ❌ No ❌ No ❌ No Desktop only
Registers a helper application in the Launch Services database.

The app must exist with given name inside the bundle in Library/LoginItems folder.

Update: A Boolean value specifying whether Launch Services should update existing information registered for the application, if any. If this parameter is false, the application will not be registered if it has already been registered previously and its current modification date has not changed from when it was last registered; if the parameter is true, the application's registered information will be updated even if its modification date has not changed.

Returns true on success and false on failure.

Some examples using this method:

The items on this page are in the following plugins: MBS MacCF Plugin.


💬 Ask a question or report a problem