First of all, I would recommend you read about user profiles.
The basic idea of user profiles is simple and unchanged from the first version of Windows NT (I mean Windows NT 3.1): A user profile consists of a directory structure that exists on the local computer. One file (the so-called bush) from the user profile is the current user part of the registry. It is important that the user has full access to his user profile. Access permission is saved not only in the file system, but also inside the registry. Therefore, to create a profile for a user, you need to create a user account earlier, because part of the security descriptor of the registry key files must contain the security identifier (security identifier) of the user.
If a new user profile is created, the prototype of the user profile will be used as the template. The path to the template can be found in the registry as the Default value in the registry key HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList . You can use GetDefaultUserProfileDirectory to get the same information.
To create a profile, you need to log in with a user account to get a login token (see LogonUser with the LOGON32_LOGON_INTERACTIVE flag for the dwLogonType parameter), and then use LoadUserProfile , which will create a local user profile if it does not exist for the user. If the user has a central or roaming profile , fill in the PROFILEINFO lpProfilePath structure so that it points to the path of the roaming user profile that is on the server. To get the path, you can use NetUserGetInfo with dwLevel equal to 4. This method is very old and is described, for example, here .
Since the login token from [LogonUser] is really only needed to obtain the SID of users that are required for access rights to their files and registry keys, starting with Vista, Microsoft introduced another simplified and very practical CreateProfile API that replaces CreateUserProfileEx (which exist only on Windows XP).
Everything that I explain earlier is really necessary only in rare situations . Basically, only if you are using a user account for a Windows service. In a standard situation, a user profile will be automatically created at the first interactive user login to a computer.
If you need to make some changes for all users on the computer, for example, after installing new software, you can do this in different ways without creating user profiles.
If you explain more precisely why you need to create user profiles, I could offer you an alternative way to archive the same goals.