Platform SDK: Exchange Server

HrInstallService

The HrInstallService function loads a service for a server object.

Quick Info

Header file: EXCHINST.H
Library: EXCHINST.LIB

HRESULT HrInstallService(
  LPSTR lpszServer,              
  LPSTR lpszSiteDN,              
  LPSTR lpszServiceDisplayName,  
  LPSTR lpszServiceName,         
  LPSTR lpszCommonName,          
  LPSTR lpszObjectGuid,          
  LPSTR lpszProductGuid,         
  LPSTR lpszExeName,             
  LPCSTR lpszDependencies,       
  LPSTR lpszAccount,             
  LPSTR lpszPassword             
);
 

Parameters

lpszServer
Input parameter. Points to a null-terminated string (with a maximum length of 256 characters) that contains the name of the server where the service is installed.
lpszSiteDN
Input parameter. Points to a null-terminated string (with a maximum length of 256 characters), containing the distinguished name (DN) of the site where the service is installed.
lpszServiceDisplayName
Input parameter. Points to a null-terminated string (with a maximum length of 256 characters) that contains the name of the service as displayed by the Microsoft Exchange Server Administrator program.

Although the service control manager preserves the case of the name that is displayed, comparisons between display names are case-insensitive.

lpszServiceName
Input parameter. Points to a null-terminated string (with a maximum length of 256 characters) that contains the name of the service which is installed. You cannot use either the forward slash (/) or back slash (\) character in a service name.
lpszCommonName
Input parameter. Points to a null-terminated string (with a maximum length of 256 characters) that contains the relative distinguished name (RDN) of the service object. Common names have the following format:

extension-name:hardware-platform

For example, suppose you have a service called NetLink with an Extension-Name attribute of NetLink. If your platform is Intel, set lpszCommonName to NetLink:i386.

lpszObjectGuid
Input parameter. Points to a null-terminated string (with a maximum length of 256 characters) that contains the service object GUID.
lpszProductGuid
Input parameter. Points to a null-terminated string (with a maximum length of 256 characters) that contains the product object GUID.
lpszExeName
Input parameter. Points to a null-terminated string (with a maximum length of 256 characters) that contains the full path to the service program.
lpszDependencies
Input parameter. Points to an array of NULL-separated strings (with a maximum length of 256 characters) that is terminated by two NULL entries. This array contains the names of services or load ordering groups that must start before this service can start.

If the entry is the name of a service, this service will not start unless this lpszDependencies service is running. If the entry is a group name, this service will not start unless at least one of the lpszDependencies group members is running. Groups names must contain the SC_GROUP_IDENTIFIER prefix character, which is defined in WINSVC.H. Note that this also means that service names cannot begin with the SC_GROUP_IDENTIFIER prefix character.

If this parameter is NULL or the string is an empty string, this service has no dependencies.

lpszAccount
Input parameter. Points to a null-terminated string (with a maximum length of 256 characters) that contains the Windows NT user account of the person who administers the service.

The account name has the following format:

DomainName\UserName

If the account belongs to the built-in domain, you can use .\UserName. If this parameter is NULL, the service is logged in under the LocalSystem account and lpszPassword must be NULL.

lpszPassword
Input parameter. Points to a null-terminated string (with a maximum length of 256 characters) that contains the user account password. If this parameter is NULL or points to an empty string, the service has no password.

Return Values

See Return Values.

Remarks

For more information on HrInstallService, see Installing an Application as a Service.

See Also

HrRemoveService