DeleteProfileA function

Deletes the user profile and all user-related settings from the specified computer. The caller must have administrative privileges to delete a user's profile.

Syntax

USERENVAPI BOOL DeleteProfileA(
  LPCSTR lpSidString,
  LPCSTR lpProfilePath,
  LPCSTR lpComputerName
);

Parameters

lpSidString

Type: LPCTSTR

Pointer to a string that specifies the user SID.

lpProfilePath

Type: LPCTSTR

Pointer to a string that specifies the profile path. If this parameter is NULL, the function obtains the path from the registry.

lpComputerName

Type: LPCTSTR

Pointer to a string that specifies the name of the computer from which the profile is to be deleted. If this parameter is NULL, the local computer name is used.

Note  As of Windows Vista, this parameter must be NULL. If it is not, this function fails with the error code ERROR_INVALID_PARAMETER.
 

Return Value

Type: BOOL

TRUE if successful; otherwise, FALSE. To get extended error information, call GetLastError.

Remarks

DeleteProfile might fail when passed the security identifier (SID) of the local system account (S-1-5-18). For more information, see KB890212.

Requirements

   
Minimum supported client Windows 2000 Professional [desktop apps only]
Minimum supported server Windows 2000 Server [desktop apps only]
Target Platform Windows
Header userenv.h
Library Userenv.lib
DLL Userenv.dll

See Also

User Profiles Overview

User Profiles Reference