RemapAndMoveUser Function

The RemapAndMoveUser function transfers the security settings and user profile from one user account to another.

Syntax

BOOL WINAPI RemapAndMoveUserA(
  __in LPCSTR pComputer,
  __in DWORD dwFlags,
  __in LPCSTR pCurrentUser,
  __in LPCSTR pNewUser
);

BOOL WINAPI RemapAndMoveUserW(
  __in LPCWSTR pComputer,
  __in DWORD dwFlags,
  __in LPCWSTR pCurrentUser,
  __in LPCWSTR pNewUser
);

Parameters

Parameter Description

pComputer [in]

Specifies the name of the computer on which the function is run. This is a pointer to a null-terminated string, and the format of the string must be “.” or \\computer. If pComputer is NULL, the function will run locally.

dwFlags [in]

Specifies how the settings and user profile will be transferred. The following flag is optional.

REMAP_PROFILE_KEEPLOCALACCOUNT 0x0004

If pCurrentUser is a local user account, then the user account is retained.

pCurrentUser [in]

Specifies the existing user account. Specify the user account in DOMAIN\user or COMPUTER\user format. This user account must have a local profile.

pNewUser [in]

Specifies the new user account where the security settings and profile of pCurrentUser will be transferred. Specify the user account in DOMAIN\user or COMPUTER\user format.

Return Value

True if the settings and user profile are successfully transferred; otherwise, False. Use GetLastError to get the failure code.

Remarks

For more information about moving user profiles on a computer running the Windows Vista operating system, see the Knowledge Base article at the Microsoft Web site (https://go.microsoft.com/fwlink/?LinkID=78007).

Requirements

Client

Requires Windows XP

DLL

Requires profmap.dll