Out of Scope : How To Programmatically Cause the Creation of a User's Profile - Windows ?

Hi, this is a new series called “Out of scope”, where i am trying to add non-Messaging Dev technologies. This won’t be supported by me nor by my team, just added based on my programming interest. So, “Out of Scope” tag is meant for general audience.

Many a times i thought how to programmatically cause a user's profile to be created without requiring an interactive logon? First of all, whether this will be possible in the Windows?

Please go through the following article . The remainder of this article demonstrates how to work with the User Profile structures and functions on Windows NT 4.0. For complete information on these structures and functions, refer to the Platform SDK documentation in the latest release of the MSDN Library.

By default, a new user's profile is not created until the user logs on to the computer interactively. An interactive logon occurs when a user logs on to the computer by pressing CTRL+ALT+DEL to gain access through the WinLogon dialog box.

It is possible to programmatically cause a user's profile to be created without requiring an interactive logon by calling the LoadUserProfile() API. In Windows 2000 and Windows XP, this function is exposed within the Platform SDK header files and documented in the MSDN Library. On Windows NT 4.0, the LoadUserProfile() API is not exposed, but it can still be called by dynamically loading the Userenv.dll library and obtaining a pointer to the function.

Calling LoadUserProfile() on Windows NT 4.0

This article has a code snippet which demonstrates how to programmatically create a new user account, force a profile to be created for the new user, and retrieve the new profile directory.