CoreApplication.RequestRestartForUserAsync(User, String) Method


Restart the app in the context of a different user.

 static IAsyncOperation<AppRestartFailureReason> ^ RequestRestartForUserAsync(User ^ user, Platform::String ^ launchArguments);
/// [Windows.Foundation.Metadata.RemoteAsync]
 static IAsyncOperation<AppRestartFailureReason> RequestRestartForUserAsync(User const& user, winrt::hstring const& launchArguments);
public static IAsyncOperation<AppRestartFailureReason> RequestRestartForUserAsync(User user, string launchArguments);
function requestRestartForUserAsync(user, launchArguments)
Public Shared Function RequestRestartForUserAsync (user As User, launchArguments As String) As IAsyncOperation(Of AppRestartFailureReason)



The user to restart the app as.




The arguments to pass to the restarted instance.


The status of the restart request.


Windows requirements

Device family
Windows 10 Fall Creators Update (introduced in 10.0.16299.0)
API contract
Windows.Foundation.UniversalApiContract (introduced in v5.0)


private async void RestartAsAnotherUser(string selectedUser)
    IReadOnlyList<User> users = await User.FindAllAsync();
    foreach (User user in users)
        object accountProperty =
            await user.GetPropertyAsync(KnownUserProperties.AccountName);
        string accountName = (string)accountProperty;
        if (accountName == selectedUser)
            // Attempt restart, with arguments.
            AppRestartFailureReason result = await App.RequestRestartForUserAsync(
                user, "-fastInit -mainMenu");

            // Restart request denied, tell the user to restart manually.
            if (result== AppRestartFailureReason.InvalidUser)
                SendToast(string.Format("Could not restart as user {0} - please manually restart.", user));


  • The app must be visible and foreground when it calls this API.
  • If the restart fails, but the user subsequently launches the app manually, the app will launch normally and no restart arguments will be passed.
  • If the app wasn't launched in the normal way, but was launched by a share contract, file picker, app-service, and so on, the app should not call this API because the user will not expect the resulting behavior.
  • The app is responsible for ensuring the validity of the User object. The activation will fail if there is policy in place which prevents that user from executing the app.
  • The app should not request an Extended Execution session after it has called this API because that will result in a poor user experience.
  • If the app has any in-process background tasks running when it calls this API, those tasks will be cancelled in the normal way. Out-of-process background tasks will not be affected.
  • When the app is restarted, LaunchActivatedEventArgs.PreviousExecutionState will have the value Terminated so that the app can distinguish between a resume and a restart.

Applies to

See also