Platform SDK: Active Directory, ADSI, and Directory Services

Converting Domain Account Name Formats

The Microsoft® Win32® functions for working with the service control manager (SCM) on a host server use the domain\username format for service accounts. For example, if you call the QueryServiceConfig function to retrieve the user account under which your service runs, the function returns the name in Fabrikam\jeffs format. To bind to the user account in the directory, for instance to change the account's password, you need the distinguished name of the account, which has the format like CN=Jeff Smith,CN=Users,DC=Fabrikam,DC=COM.

To convert between the various name formats, use the TranslateName function, which can also be used to convert a name to other formats, such as a user principal name (UPN)..