UserEnvDeleteProfile Method

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.

Definition

Namespace: DevCase.Win32.NativeMethods
Assembly: DevCase.net48 (in DevCase.net48.dll) Version: 6.0.0.0 (6.0)
XMLNS for XAML: Not mapped to an xmlns.
[DllImportAttribute("UserEnv.dll", CharSet = CharSet.Auto, BestFitMapping = false, 
	ThrowOnUnmappableChar = true, SetLastError = true)]
public static bool DeleteProfile(
	string userSid,
	string profilePath,
	string computerName
)

Parameters

userSid  String
Pointer to the SID of the user as a string.
profilePath  String
Pointer to a string that specifies the profile path.

If this parameter is , the function obtains the path from the registry.

computerName  String
Pointer to a string that specifies the name of the computer from which the profile is to be deleted.

If this parameter is , the local computer name is used.

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

Return Value

Boolean
If the function succeeds, the return value is .

If the function fails, the return value is .

To get extended error information, call GetLastWin32Error.

Remarks

See Also