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\jeffsmith" format. To bind to the user account in the directory, for example to change the account password, the distinguished name of the account is required, which has the format "CN=Jeff Smith,CN=Users,DC=Fabrikam,DC=COM".

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