Windows 10 run as different user

Как в Windows запустить программу от имени другого пользователя с помощью контекстного меню и утилиты runas. Создаем ярлык runas для запуска программ с правами

Любой пользователь Windows может запустить в своей сессии программу от имени другого пользователя с помощью Run As. Благодаря этому вы можете выполнить скрипт (.bat, .cmd, .vbs, .ps1), запустить исполняемый .exe файл или установку приложения (.msi, .cab) с полномочиями другого пользователя.

Например, вы можете использовать RunAs для установки программ или запуска программ/скриптов/MMC оснасток с правами администратора непосредственно в сессии обычного непривилегированного пользователя. Также через RunAs вы можете запустить приложение, настроенное в профиле другого пользователя (приложение загрузится с настройки из профиля другого пользователя).

За возможность запуска программ от имени другого пользователя в Windows отвечает служба Вторичный вход в систему (Secondary Log-on). Если эта служба остановлена, тогда все описанные методы runas работать не будут. Вы можете проверить, что служба запущена с помощью следующей команды PowerShell:

Get-Service seclogon

windows - служба вторичного входа в систему нужна для запуска от имени

В Windows есть несколько способов запустить программу или процесс от имени другого пользователя.

Содержание:

  • Запуск программы от имени другого пользователя из Проводника Windows (File Explorer)
  • Команда Runas: запуск программ от имени из командной строки
  • Использование RunAs в PowerShell
  • Запуск программ от имени другого пользователя без ввода пароля
  • Ярлык с запуском программы от имени другого пользователя
  • В проводнике Windows отсутствует пункт “Запуск от имени другого пользователя”
  • Как добавить пункт “Запуск от имени” для программ в меню Пуск?

Запуск программы от имени другого пользователя из Проводника Windows (File Explorer)

Самый простой способ запустить программу из-под другого пользователя – воспользоваться графическим интерфейсом Проводника Windows (File Explorer). Просто найдите нужно приложение (или ярлык), зажмите клавишу Shift и щелкните по нему правой кнопкой мыши. Выберите пункт контекстного меню «Запуск от имени другого пользователя» (Run as different user).

Примечание. Если пункт меню «Запуск от имени другого пользователя» отсутствует, см. следующий раздел.

Запуск от имени другого пользователя - конекстное меню

В появившемся окне Windows Security нужно указать имя и пароль пользователя, под чьей учетной записью нужно запустить программу и нажать кнопку ОК.

Примечание.

  • Если нужно запустить программу от имени пользователя Active Directory, нужно указать его имя в формате userPrincipalName (
    [email protected]
    ) или samAccountName (
    DomainNameUserName
    );
  • Если ваш компьютер добавлен в домен AD, то для запуска программы от имени локальной учетной записи пользователя ее имя нужно указать в формате:
    .localusername
    .

runas different user

Важно. Вы можете запустить программу от имени другого пользователя только, если для него задан пароль. Использовать Runas для пользователя с пустым паролем не получится.

Откройте Диспетчер задач и убедитесь, что приложение запущенно под указанным пользователем.

диспетчер задач windows видит, что процесс запущен от имени другого пользователя

Команда Runas: запуск программ от имени из командной строки

В Windows есть консольная утилита runas.exe, которую можно использовать для запуска приложений от имени другого пользователя из командной строки. Также команда runas позволяет сохранить пароль пользователя в Windows Credential Manager, чтобы его не приходилось набирать каждый раз.

Откройте командную строку (или окно Выполнить, нажав сочетание клавиш Win+R). Для запуска Блокнота с правами учетной записи administrator выполните команду:

runas /user:administrator “C:Windowscmd.exe”

Совет. Если имя пользователя содержит пробелы, его нужно взять в кавычки:

runas /user:”user test” notepad.exe

runas /user:admin

В отрывшемся окне появится приглашение «Введите пароль для admin», где нужно набрать пароль и нажать Enter.

Введите пароль для admin

Должно открыться ваше приложение. В моем случае это cmd. В заголовке окна указано Запущено от имени
CompNameusername
:

cmd.exe заголовок запущено от другого имени

Можно, например, открыть панель управления под другим пользователем:

runas /user:admin control

Если нужно запустить программу от имени доменного пользователя, нужно использовать формат имени
[email protected]
или
DomainNameUserName
.

Например, чтобы с помощью блокнота открыть текстовый файл от имени пользователя server_admin домена CORP, используйте команду:

runas /user:corpserver_admin “C:Windowsnotepad.exe C:tmp2871997x64.txt”

команда runas в windows под доменным пользователем

Введите пароль для corpserver_admin:
Попытка запуска C:Windowsnotepad.exe C:tmp2871997x64.txt от имени пользователя "corpserver_admin" ...

Если указали несуществующее имя пользователя или неверный пароль, появится ошибка:

RUNAS ERROR: Unable to run - yourcommand
1326: The user name or password is incorrect.

Или

RUNAS ERROR: Unable to acquire user password

Иногда нужно запустить программу от имени доменного пользователя с компьютера, который не добавлен в домен AD. В этом случае нужно использовать такую команду (при условии, что в сетевых настройках вашего компьютера указан DNS сервер, который может отрезолвить этот домен):

runas /netonly /user:contosoaaivanov cmd.exe

Если для запуска программы от другого пользователя не нужно загружать его профиль, используйте параметр /noprofile. При этом приложение запускается намного быстрее, но может вызвать некорректную работу программ, которые хранят данные в профиле пользователя.

Использование RunAs в PowerShell

Если вам нужно запускать программы/процессы от имени другого пользователя из PowerShell, вы можете использовать командлет Start-Process (управление процессами с помощью PowerShell). Сначала нужно запросить учетную запись и пароль пользователя:

$Cred = (Get-Credential)

Для запуска процесса от имени другого пользователя можно использовать:

Start-Process -FilePath "powershell.exe" -Credential $Cred

Либо можно запросить учетную запись и пароль интерактивно через Windows Security:

# "Run as Administrator"
Start-Process -FilePath "powershell.exe" -Verb RunAs
# Run as от другого пользователя
Start-Process -FilePath "powershell.exe" -Verb RunAsUser

powershell запуск процесса от другого пользователя start-process

Если вам нужно запустить программу через runas от имени другого администратора в привилегированном режиме (по умолчанию UAC запускает программу в not-elevated пользовательском контексте), можно использовать такую команду PowerShell:

Start-Process powershell -Credential winitproadmin2 -ArgumentList '-noprofile -command &{Start-Process "cmd.exe" -verb runas}'

Или стороннюю утилиту ShelExec:

ShelExec /Verb:runas cmd.exe

Запуск программ от имени другого пользователя без ввода пароля

Вы можете сохранить пароль пользователя, который вы вводите. Для этого используется параметр /savecred.

runas /user:admin /savecred “C:Windowsnotepad.exe”

После указания пароля он сохранится в диспетчере паролей Windows.

сохраненные паролья runas в windows в диспетчере учетных данных

При следующем запуске команды runas под этим же пользователем с ключом
/savecred
Windows автоматически получит сохраненный пароль из Credential Manager, и не будет запрашивать его повторно.

Чтобы вывести список всех пользователей, для которых сохранены пароли, используется команда:

RunDll32.exe keymgr.dll,KRShowKeyMgr

runas /user:admin /savecred - сохранние пароля в менеджере паролей

Однако использование параметра /savecred не безопасно, т.к. пользователь, в чьем профиле сохранен чужой пароль может использовать его для запуска любой команды под данными привилегиями, или даже сменить чужой пароль. Кроме того, сохраненные пароли из Credential Manager можно легко украсть, поэтом лучше запретить использование сохраненных паролей (а тем более нельзя сохранять пароль привилегированной административной учетной записи).

Примечание. Кроме того, ключ /savecred не работает в Home редакциях Windows.

Вы можете использовать команду RunAs для запуска mmc оснасток от имени другого пользователя. К примеру, если под другим пользователем нужно запустить оснастку Active Directory Users and Computers из набора инструментов администрирования RSAT, можно воспользоваться такой командой.

runas.exe /user:winitprokbuldogov "cmd /c start mmc %SystemRoot%system32dsa.msc"

Аналогичным образом можно запустить любую другую оснастку (главное знать ее имя).

Ярлык с запуском программы от имени другого пользователя

Вы можете создать на рабочем столе ярлык для запуска программы от имени другого пользователя. Просто создайте новый ярлык, в окне с адресом объекта которого укажите команду
runas
с нужными параметрами:

runas /user:winitprokbuldogov  “C:Windowsnotepad.exe”

ялык рабочего стола для запуска программы от имени в windows

При запуске такого ярлыка будет запрашиваться пароль пользователя.

Если в ярлыке runas добавить параметр
/savecred
, то пароль будет запрошен только один раз. После этого пароль будет сохранен в Credential Manager и автоматически подставляться при запуске ярлыка от имени другого пользователя без запроса пароля.

Такие ярлыки довольно часто используются для запуска программ, которые требуют прав администратора для запуска. Однако есть более безопасные способы запуска программы без прав администратора, или отключения запроса UAC для определенного приложения.

В проводнике Windows отсутствует пункт “Запуск от имени другого пользователя”

Если в контекстном меню проводника Windows отсутствует пункт Запуск от имени другого пользователя (Run as different user), нужно проверить настройки двух параметров реестра Windows.

В Windows вы можете скрыть или показать в проводнике пункт меню RunAs с помощью двух параметров реестра:

  • Параметр HideRunAsVerb (тип REG_DWORD) в ветке реестра HKLMSOFTWAREMicrosoftWindowsCurrentVersionpoliciesExplorer (1 – скрыть пункт runas, 0 – показать)
  • Параметр EnableSecureCredentialPrompting (REG_DWORD) в HKLM SoftwareMicrosoftWindowsCurrentVersionPoliciesCredUI (1 – скрыть, 0 – показать)

Если в Windows не отображается пункт Run as different user, проверьте значения этих параметров реестра и измените их на 0. В доменной среде вы можете распространить значения этих параметров реестра на компьютеры с помощью Group Policy Preferences.

Второму параметру реестра соответствует отдельная опция GPO.

Этой опции GPO соответствует параметр EnableSecureCredentialPrompting в ветке реестра HKLM SoftwareMicrosoftWindowsCurrentVersionPoliciesCredUI. Откройте редактор локальных групповых политик (gpedit.msc) и убедитесь, что в разделе Конфигурация компьютера -> Административные шаблоны -> Компоненты Windows -> Пользовательский интерфейс учетных данных (Computer Configuration -> Administrative Templates -> Windows Components -> Credential User Interface) отключена (Не задана) политика Запрашивать достоверный путь для входа в учетную запись (Require trusted path for credential entry).

Запрашивать достоверный путь для входа в учетную запись (Require trusted path for credential entry) - политика

Как добавить пункт “Запуск от имени” для программ в меню Пуск?

По-умолчанию в Windows 10 у элементов меню Пуск (начального экрана) отсутствует возможность запуска приложений от имени другого пользователя. Чтобы добавить в контекстное меню пункт “Запуск от имени другого пользователя”, нужно включить политику Показывать команду «Запуск от имени другого пользователя» при запуске (Show “Run as different user” command onStart) в разделе редактора групповых политик (консоль
gpedit.msc
) Конфигурация пользователя ->Административные шаблоны -> Меню Пуск и панель задач (User Configuration -> Administrative Templates -> Start Menu and Taskbar).

включить политику Показывать команду «Запуск от имени другого пользователя» при запуске

Либо, если редактор gpedit.msc отсутствует, создать в ветке реестра HKEY_CURRENT_USERSoftwarePoliciesMicrosoftWindowsExplorer ключ типа DWORD с именем ShowRunasDifferentuserinStart и значением 1.
New-ItemProperty -Path "HKCU:SoftwarePoliciesMicrosoftWindowsCurrentVersionExplorer" -Name ShowRunasDifferentuserinStart -Value 1 -PropertyType DWORD -Force

ShowRunasDifferentuserinStart - реестр

Осталось обновить групповые политики (gpupdate /force) и убедиться, что у программ в меню Пуск появится новое контекстное меню Дополнительно -> Запуск от имени другого пользователя.

windows 11 run as different uzer в стартовом меню пуск

Пункт “запуск от имени” отсутствует у Universal Windows Platform (UWP) приложения из Microsoft Store. Вы можете запустить UWP приложение от другого пользователя из командной строки с помощью runas.exe.

Выведите список приложений Microsoft Store на компьютере с помощью PowerShell:

Get-AppxPackage|select Name

Можно найти конкретное приложение

Get-AppxPackage|where {$_.Name -like '*team*'} |select Name

Найдите имя нужного приложения в списке. Например, для запуска встроенного клиента Microsoft Teams Chat от другого пользователя, выполните:

runas /user:user1 "explorer.exe MicrosoftTeams:"



August 29, 2016 updated by

Leave a reply »

How can you run a script or application as another user? In this tutorial we’ll show you 3 ways to run apps as different user in Windows 10.

Method 1: Shift + Right-Click Context Menu

Open File Explorer and browse to the executable file you wish to run as different user. Simply hold down the Shift key and right-click on the executable file, select Run as different user from the context menu.

shift-run-as-different-user

Next you have to enter the user name and the password of the user which we want use to open the application.

enter-user-credentials

Method 2: Run as Different User via Command Line

Runas is a very useful command in Windows. This command allows to run applications under a different user account, even as an Administrator. To use the Runas command, you need to provide a different user’s credentials and the full path of the application you want to run.

For example, if you want to open Notepad as your Windows user Bob, the command line would be as below.
runas /user:Bob “C:Windowsnotepad.exe”

runas-cmd

After running the above command, you will be asked to enter the password of Bob account. After password validation, Notepad will be opened with the specified account credentials.

Method 3: Run as Different User via Start Menu

If you want to run apps as different user from Start Menu in Windows 10, you need to tweak the Group Policy setting.

  1. Press the Windows + R key combination to bring up the Run box, type gpedit.msc and hit Enter.
  2. In the Local Group Policy Editor window, navigate to:
    User ConfigurationAdministrative TemplatesStart Menu and Taskbar
  3. In right-side pane, double-click on the policy called Show “Run as different user” command on Start.

    run-as-different-user-gpo

  4. Set the policy to Enabled, then click OK to save your changes.

    show-run-as-different-user

  5. Reboot your computer. Right-click any application on the Start Menu, you’ll see a new option “Run as different user” for quick access.

    rus-as-user-via-start

  • Previous Post: How to Change or Restore Desktop Icons in Windows 10
  • Next Post: Revert Windows 10 Updates by Going Back to Previous Build

Any Windows user can run a program in his current session on behalf of another user using RunAs. This allows you to run a script (.bat, .cmd, .vbs, .ps1), an executable .exe file, or install an application (.msi, .cab) with the permissions of another user.

For example, you can use RunAs to install apps or run MMC snap-ins under the administrator account in a non-elevated (unprivileged) user session. Also, you can use RunAs to run an application configured in another user’s profile (the application will load its settings from another user’s profile).

There are several ways to run a program or process as another user in Windows.

Contents:

  • How to Run Apps as Different User from File Explorer?
  • RunAs Command: Run a Program Under a Different User from CMD
  • Using RunAs in PowerShell
  • How to Use RunAs Without Password Prompt?
  • How to Create a Shortcut to Run as Different User?
  •  “Run As Different User” Option is Missing in Windows
  • Add “Run As” Option to Start Menu in Windows 10

The Secondary Log-on service (seclogon) is responsible for allowing programs to run as different users in Windows. If this service is stopped, all of the described RunAs methods won’t work. You can check that the service is started with the following PowerShell command:

Get-Service seclogon

secondary logon service needs to use runas feature on windows

How to Run Apps as Different User from File Explorer?

The easiest way to run an application under another user is to use the Windows File Explorer GUI. Just find an application (or a shortcut) you want to start, hold the Shift key, and right-click on it. Select Run as different user in the context menu.

Note. If the menu item “Run as different user” is missing, scroll down the article. 

Run as different user option

In the Windows Security window that appears, you need to specify the name and password of the user under whose account you want to run the application and click OK.

Note.

  • If you want to run the program as an Active Directory user, you must specify its name in the userPrincipalName ( UserName@DomainName.com ) or samAccountName ( DomainNameUserName ) format ;
  • If your computer is joined to an AD domain, then to run the program on behalf of a local user account, specify its name in the following format: .localusername .

windiows security dialog - enter different user's password

Important. You can run the program as another user only if a password has been set for that user. You won’t be able to use Runas for a user with an empty password

Open the Task Manager and make sure that the application is running under the specified user account.

taskmanager the application is running under different user

RunAs Command: Run a Program Under a Different User from CMD

You can use the Windows built-in runas.exe CLI tool to run apps as a different user from the command prompt. The runas command also allows you to save the user’s password to the Windows Credential Manager so that you don’t have to enter it every time.

Open the command prompt (or the Run window by pressing Win+R). To start the Notepad.exe under the administrator account, run this command:

runas /user:admin "C:Windowsnotepad.exe"

Tip. If the username contains spaces, it must be enclosed in quotation marks:

runas /user:"antony jr" notepad.exe

using runas in command prompt

In the next window, the prompt “Enter the password for admin” appears, where you have to enter the user’s password and press Enter.

Enter the password for admin

Your application should start. In my case, this is cmd.exe. The window title says “running as PCNameusername“:

cmd running as different user in windows 10

For example, you can open the Control Panel under a different user:

runas /user:admin control

If you need to run a program as a domain user, use the following name format UserName@DomainName or DomainNameUserName. For example, to open a text file using notepad on behalf of a domain user account, use the command:

runas /user:corpserver_admin "C:Windowssystem32notepad.exe C:psregion.txt"

Attempting to start an app as different user

Enter the password for corpserver_admin:
Attempting to start C:Windowssystem32notepad.exe C:psregion.txt as user "corpserver_admin " ...

If you specified a non-existent username or an invalid password, an error will appear:

RUNAS ERROR: Unable to run - yourcommand
1326: The user name or password is incorrect.

or

RUNAS ERROR: Unable to acquire user password

Sometimes you need to run a program as a domain user from a computer that is not joined to the Active Directory domain. In this case, you need to use the following command (it is assumed that the DNS server that can resolve this domain is specified in the network settings of your computer):

runas /netonly /user:contosobmorgan cmd.exe

If you don’t want to load the user profile when starting the program as a different user, use the /noprofile parameter. In this case, the application starts much faster but may cause incorrect operation of programs that store data in the user’s profile.

Using RunAs in PowerShell

If you need to run programs/processes as another user from PowerShell scripts, you can use the Start-Process cmdlet (Managing Windows processes with PowerShell). First, you need to get the user’s credentials:

$Cred = (Get-Credential)

To start the process, command, or app as another user you can use the PowerShell command:

Start-Process -FilePath "powershell.exe" -Credential $Cred

Or you can get user credentials interactively through Windows Security prompt:

# Run as Administrator
Start-Process -FilePath "powershell.exe" -Verb RunAs
# Run as from another user
Start-Process -FilePath "powershell.exe" -Verb RunAsUser

powershell: run process as different user

If you need to run a program as an administrator in elevated mode (by default, UAC runs the program in a not-elevated user context), you can use the following PowerShell command:

Start-Process powershell -Credential woshubjsmith -ArgumentList '-noprofile -command &{Start-Process "cmd.exe" -verb runas}'

Or a third-party ShelExec tool:

ShelExec /Verb:runas cmd.exe

How to Use RunAs Without Password Prompt?

You can save the user credentials (with password) that you enter. The /savecred parameter is used for this.

runas /user:admin /savecred “C:Windowscmd.exe”

After specifying the password, it will be saved to the Windows Credential Manager.

The next time you run the runas command under the same user with the /savecred key, Windows will automatically use the saved password from the Credential Manager without prompting to enter it again.

To display a list of saved credentials in Credential Manager, use the following command:

rundll32.exe keymgr.dll, KRShowKeyMgr

windows runas with savecred option

However, it is not safe to use the /savecred parameter. A user whose profile has saved someone else’s password can use it to run any app or command under those privileges or even change another user’s password. Also, it is easy to steal passwords saved in the Credential Manager so it is recommended to prevent a Windows from saving passwords (and never save the password of the privileged administrative accounts).

Note. In addition, /savecred option doesn’t work in the Windows Home edition versions.

You can use the RunAs command to run mmc snap-ins as a different user. For example, if you want to run the Active Directory Users and Computers snap-in (from the RSAT administration toolkit) as a different user, you can use this command:

runas.exe /user:DOMAINUSER "cmd /c start "" mmc %SystemRoot%system32dsa.msc"

In the same way, you can run any other snap-in (if you know its name).

How to Create a Shortcut to Run as Different User?

You can create a shortcut on your desktop that allows you to run the program as a different user. Just create a new shortcut, and specify the runascommand with the necessary parameters in the Location field:

runas /user:admin  “C:Windowsnotepad.exe”

shortcut with runas command

When you run such a shortcut, you will be prompted to enter a user password.

If you additionally add the /savecred parameter in the runas shortcut, then the password will be prompted only once. The password will be saved in Credential Manager and automatically used when you run the shortcut on behalf of another user without prompting for a password.

Such shortcuts are quite often used to run programs that require elevated permissions to run. However, there are safer ways to run a program without administrator privileges or disable the UAC prompt for a specific application.

 “Run As Different User” Option is Missing in Windows

If the “Run as different user” option is missing from the application’s context menu in File Explorer, you need to check the values of two Windows registry parameters.

On Windows, you can hide or show the RunAs menu item in File Explorer using two registry parameters:

  • The HideRunAsVerb parameter (REG_DWORD) under the registry key HKLMSOFTWAREMicrosoftWindowsCurrentVersionpoliciesExplorer (1 – hide the RunAs item, 0 – show it);
  • EnableSecureCredentialPrompting (REG_DWORD) under HKLM SoftwareMicrosoftWindowsCurrentVersionPoliciesCredUI (1 – hide, 0 – show).

If Windows does not display the right-click menu option “Run as another user”, check the values of these registry settings and change them to 0. In a domain environment, you can deploy these registry parameters to computers using Group Policy Preferences.

The EnableSecureCredentialPrompting parameter corresponds to a separate GPO option. Open the Local Group Policy Editor (gpedit.msc) and make sure that the Require trusted path for credential entry policy is disabled (or not configured) in Computer Configuration -> Administrative Templates -> Windows Components -> Credential User Interface.

GPO: Require trusted path for credential entry

Add “Run As” Option to Start Menu in Windows 10

By default, items in Windows Start Menu do not have a  “Run As” option. In order to add the “Run as different user” option, enable the “Show Run as different user command on Start” policy in User Configuration -> Administrative Templates ->Start Menu and Taskbar section of the Local Group Policy Editor (gpedit.msc).

Show “Run as different user” command on Start

Or, if the gpedit.msc is missing, create a new DWORD parameter with the name ShowRunasDifferentuserinStart and value 1 under the registry key HKEY_CURRENT_USERSoftwarePoliciesMicrosoftWindowsExplorer. You can use the following PowerShell command to add the registry parameter:

New-ItemProperty -Path "HKCU:SoftwarePoliciesMicrosoftWindowsCurrentVersionExplorer" -Name ShowRunasDifferentuserinStart -Value 1 -PropertyType DWORD -Force

ShowRunasDifferentuserinStart registry

Update the Group Policy settings (gpupdate /force) and make sure that a new context menu More -> Run as different user has appeared for the programs in the Start menu.

windows 11 start menu item to runas another user

The “run as different user” option is missing from the context menu of Universal Windows Platform (UWP, Microsoft Store ) apps. You can run a UWP app as a different user from the command prompt using runas.exe.

List the Microsoft Store apps on your computer using PowerShell:

Get-AppxPackage|select Name

You can find a specific app:

Get-AppxPackage|where {$_.Name -like '*teams*'} |select Name

Find the name of the desired application in the list. For example, to run the built-in Microsoft Teams Chat client as another user, do the following:

runas /user:user1 "explorer.exe MicrosoftTeams:"

Как запустить программу от имени другого пользователяПо умолчанию программы в Windows запускаются от имени текущего пользователя, а при необходимости — с правами администратора. Однако, в некоторых случаях может потребоваться запуск какого-либо приложения от имени другого пользователя, с его сохраненными данными, но без входа в соответствующий аккаунт.

В этой простой инструкции подробно о том, как запустить какую-либо программу от имени другого пользователя Windows 11 или Windows 10 различными способами, если вдруг такая необходимость возникла. Также может быть полезным: запуск программ от имени администратора в Windows.

Простой запуск от имени другого пользователя

Самый простой и быстрый способ запустить программу от другого пользователя — использовать контекстное меню Windows 11/10, для этого достаточно:

  1. Удерживая клавишу Shift, нажать правой кнопкой мыши по ярлыку или исполняемому файлу программы.
  2. В контекстном меню выбрать пункт «Запуск от имени другого пользователя». Запуск от имени другого пользователя в контекстном меню
  3. Ввести имя другого пользователя и соответствующий этой учетной записи пароль. Ввод учетных данных для запуска от имени другого пользователя

На этом всё — программа будет запущена от имени выбранного пользователя, а если она содержит сохраненные данные для выбранной учетной записи, загружены будут и они.

В случае, если у вас нет ярлыка программы, а её месторасположение неизвестно, вы можете применить следующий подход: найти программу по имени через поиск в панели задач, нажать по найденному результату правой кнопкой мыши и выбрать пункт «Перейти к расположению файла», а уже затем использовать описанный ранее подход для запуска от другого пользователя.

Запуск программы или команды от имени другого пользователя в командной строке

Ещё один подход — использовать команду RUNAS в командной строке Windows. Также с помощью этой команды можно создать ярлыки для запуска приложений от других пользователей. Самый простой пример использования команды RUNAS:

  1. Откройте командную строку (сделать это можно, используя поиск в панели задач).
  2. Введите команду (если имя пользователя содержит пробелы, возьмите его в кавычки):
    runas /user:ИМЯ_пользователя "Полный путь к файлу программы и параметры запуска при необходимости"
  3. Введите пароль выбранной учетной записи пользователя, если он будет запрошен. Запуск от имени другого пользователя с помощью командной строки и RunAs

В результате программа будет запущена от имени указанного пользователя. Команда имеет и другие параметры, справку можно получить, введя runas без параметров в командной строке. Например, можно включить или отключить использование данных профиля пользователя, сохранить учетные данные с помощью параметра /savecred для того, чтобы при следующих запусках от имени выбранного пользователя ввод пароля не требовался.

Существуют и другие, иногда более функциональные решения для запуска программ или bat файлов от имени других пользователей, одно из самых известных — утилита PsExec, входящая в Microsoft Sysinternals Suite и позволяющая выполнить не только описанную задачу, но и множество других.

Running an application as a different user (e.g. domain admin account) from the start menu (by shift + right-clicking the application) used to be an option in Windows 7 & XP.

However, I can’t find that option in Windows 10. The workaround seems to be either 1) to find the application in Windows Explorer (shift + right-click) or 2) use runas.exe from the command line.

However, in order to use those workarounds, I have look up the executable name first. It’s a bit difficult because I don’t have the name of every RSAT tool or executable name memorized.

(e.g. «Active Directory Users and Computers» is dsa.msc, «Routing and Remote Acces» is rrasmgmt.msc)

Is there a simpler way to do this?

fixer1234's user avatar

fixer1234

26.8k61 gold badges72 silver badges115 bronze badges

asked Feb 25, 2016 at 1:02

HSuke's user avatar

0

  1. Open Registry Editor by pressing Windows + R key combination, type in regedit and press Enter. If prompted by UAC, click on Yes to continue.
  2. Go to HKEY_CURRENT_USERSoftwarePoliciesMicrosoftWindowsExplorer — If you do not find this key, then right click and add the Explorer key under Windows and add DWORD value ShowRunasDifferentuserinStart
  3. In right-side pane, right click on ShowRunasDifferentuserinStart key and then click Modify.
  4. Enter 1 as the value in Value data box
  5. Click Ok to save the setting.
  6. Close Registry Editor. Restart the system.

After rebooting, you should have the «Run as different user option», sometimes under the «More» drop down.

I’ve done this on several domain joined and non domain joined PCs, works like a charm.

Source: windows10update.com

Community's user avatar

answered Feb 25, 2016 at 5:18

1

There is another (probably new) solution to enable this functionality, which is far more simple than the other ones offered. Simply navigate to the Settings > Update & security > For developers, and under the Windows Explorer one can see a list of things that can be applied.

That list of things that you may apply, might be a little hard to understand at the first look, but I believe it works like this: If it is grayed-out, then it means that that particular thing is already like that (enabled), and hitting the Apply will enable the ones that are not grayed-out and are currently selected.

Following that description I’ve just made up, if one wants to enable just the Change policy to show Run as different user in Start, he/she has to remove the checks from all the others and hit the Apply.

And finally, here’s a screenshot of the particular setting I am talking about:

enter image description here

answered Jan 26, 2017 at 22:26

Utkan Gezer's user avatar

1

As long as the Secondary Logon service (seclogon) is running, the following code blocks permit a combination of Batch and VBScript files to automate the task. the batch file uses relative path references to allow the files to be places into any path that allows at least read permission by the current and selected user accounts. Both files should be located within the same path. The use of ShellExecute with a verb of runasuser causes Windows to bring up a prompt to allow the user to select from any logon method allowed by the host computer.

This process can be added to a users startup processes so that it occurs once logged into a computer system.

Batch file: {RunAsUser}{CMD}.cmd

@Echo Off

If "%~1" NEQ "/CALLBACK" Goto :label_Process_Run_As_User

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
REM Start the process once running as designated user
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

cd C:
start "" %~dp0cmd.lnk

Goto :EOF

:label_Process_Run_As_User

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
REM Section below verifies if Secondary Login is available
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

REM Query [Secondary Logon]
sc query seclogon 1> nul 2> nul || (
    Goto :label_Missing_Secondary_Login
)

REM Check to see if [Secondary Logon] service is not disabled
sc qc seclogon | Find /i "START_TYPE" | Find /i "DISABLED" 1> nul 2> nul && (
    Set flg.SecLog.Enabled=F
) || (
    Set flg.SecLog.Enabled=T
)

REM Check to see if [Secondary Logon] service is Running
sc queryex seclogon | Find /i "STATE" | Find /i "RUNNING" 1> nul 2> nul && (
    Set flg.SecLog.Running=T
) || (
    Set flg.SecLog.Running=F
)

REM Determine if action should work
If /i "%flg.SecLog.Enabled%:%flg.SecLog.Running%" EQU "F:F" Goto :label_Secondary_Login_Unavailable

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
REM Section below starts the RunAsUser process
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

REM System configuration was validateed and RunAsUser will commence

Set "str.SELF=%~0"

WSCRIPT /E:VBSCRIPT "%~dp0RunAsUser.txt"

Goto :EOF

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
REM Section below provides written notices to user for error conditions
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

:label_Secondary_Login_Unavailable
Echo.
Echo Unable to utilize the Secondary Logon system service because it is disabled.
Echo.
pause
Goto :EOF

:label_Missing_Secondary_Login
Echo.
Echo Unable to find the Secondary Logon system service
Echo.
pause
Goto :EOF

VBScript file: RunAsUser.txt

'-------------------------------------------
'
' Launch Process RunAsUser
CreateObject("Shell.Application").ShellExecute CreateObject("WScript.Shell").Environment("PROCESS")("str.SELF"), "/CALLBACK", "", "runasuser", 1
'
' Display a message box to pause script
msgbox "Enter username or select Certificate for account" & vbCrLf & "On the windows dialog that will popup." & vbCrLf & vbCrLf & "Click OK once process opens", vbokonly
'
' Quit the script
On Error Resume Next
Window.Close ' HTA Must be Closed Through the Window Object
Err.Clear
Wscript.Quit ' VBS Must be Closed Through the Wscript Object
Err.Clear
On Error Goto 0
'
' ----------------------------------------------------------------------

answered Sep 26, 2018 at 18:35

CoveGeek's user avatar

Since its very first version, Windows NT has allowed the user to launch apps with different permissions and credentials than the current user. Using it, you can start a batch file, an executable file or even an app installer as another user. Let’s see how it can be done.

There are two ways to run a process as a different user in Windows 10. This can be done using the context menu in File Explorer or with a special console command.

Having this ability is very useful in a wide range of situations. For example, if you are working under a limited user account, but need to install an app or open an MMC snap-in like Disk Management, you can run the required app under another user account which has administrator privileges. It is especially useful when an app doesn’t ask for administrative credentials and just refuses to start. Another good example is when you have configured an app to work under a different user profile, so other apps and users won’t have access to its configuration data. This improves the security for apps which deal with very sensitive data.

To run an app as a different user in Windows 10, do the following.

  1. Open File Explorer and go to the folder which contains the required app.
  2. Press and hold the Shift key and right-click on the file.
  3. In the context menu, select Run as different user.Run As Different User Context Menu
  4. Enter the new credentials and click OK to run the app.Windows 10 Run As Different User

You are done.Windows 10 An App Is Running As A Different User

Tip: You can make the ‘Run as’ command always visible in the context menu and in the Start menu. See the following articles:

  • Make Run as Always Visible in Context Menu in Windows 10
  • Add Run as different user to Start Menu in Windows 10

Also, you can use Winaero Tweaker to save your time. It allows adding the Run as a different user command to both the Start menu and the context menu.

Winaero Tweaker 0.10 Run As Always Visible

You can download the app here: Download Winaero Tweaker.

Now, let’s see how to run apps as a different user from the command prompt. This will allow you to run the app from the command line or with a shortcut. Also, using this method, it is possible to save the another user’s credentials, so you won’t have to enter them every time when starting an app using the shortcut to start the app as that user. For command line use, Windows 10 includes the runas console tool.

Run as different user using the command prompt

  1. Open a command prompt.
  2. Type the following command:
    runas /user:"USERNAME" "Full path of file"

    Replace the USERNAME portion with the correct user name and provide the full path to the executable file, msc file, or batch file. It will be started under a different user account.Windows 10 Runas Tool Step 1

  3. To save the credentials for the provided user account, add the /savecred option to the command line, as follows:
    runas /user:"USERNAME" /savecred "Full path of file"

    The next time you run an app under the same credentials, you won’t be asked for the user account password.Windows 10 Runas Tool Step 2

The provided credentials will be saved in Credential Manager in the Control Panel. See the following screenshot.Windows 10 Runas Tool Step 3

Tip: Using the runas console tool, it is easy to create a shortcut to launch apps under a different user in Windows 10. Use the last command as your shortcut target.

runas /user:"USERNAME" /savecred "Full path of file"

Run it once from the command prompt to save the password, so that the shortcut directly starts apps without extra prompts subsequently.Windows 10 Runas Tool Step 4

That’s it.

Support us

Winaero greatly relies on your support. You can help the site keep bringing you interesting and useful content and software by using these options:

If you like this article, please share it using the buttons below. It won’t take a lot from you, but it will help us grow. Thanks for your support!

While most of the Windows users are familiar with the “Run as Administrator” feature, but a few know about “Run as different user.” Luckily, Windows 10 offers both the options “Run as Administrator” and “Run as different user.”

You might already know that the “Run as different user” functionality is not new to Windows 10; it was first introduced in Windows XP. For some reason, Microsoft dropped this feature on Windows Vista. Again “Run as different user” was introduced in Windows 7, and now it continues in Windows 8 and Windows 10. Fortunately, Microsoft has not dropped the “Run as Administrator” feature in any version of Windows operating systems.

Both “Run as Administrator” and “Run as different user” are handy features on Windows 10 if you want to run an application with other user account privileges on your PC. Run as administrator functionality allows you to run any application with admin privilege while logged in as a normal user. That means to perform an administrative task on your PC, you don’t have to switch to an administrator account.

Similarly, using the “Run as different user” feature, you can run an application from another user account of your PC. No need to switch to that user account; what a nice feature?

How do I run a program with administrator rights from a standard user account?

It is quite simple to run a program with an administrator right from a standard user account. Just right-click on the application or program that you want to run as administrator.

Now User Account Control dialog will appear, where you need to enter the administrator account’s password to continue.

That’s all.

How do I run a program with another user’s rights?

If you want to run a program or application with another user’s rights without actually switching to that account, do the following:-

Step 1. Press and hold the Shift key from the keyboard and then perform a right-click on an application or program that you would like to launch with another user account privileges.

Step 2. Windows Security dialog box will appear. Here, enter the “User name” and “Password” of the user account from which privilege you want to run the application. Finally, click the OK button.

How to Run a Program with Another User’s Rights using Command Prompt?

You can also utilize Command Prompt to run a program or application with other user rights on Windows 10, even as an Administrator. To use the Runas command, you need to provide a different user’s credentials and the full path of the application you want to run.

For instance, if you would like to access Notepad with a Test user account that is available on your PC, execute the below-mentioned command in the Command Prompt window:-

runas /user:Test “C:Windowsnotepad.exe”

After executing the above command, you will be prompted to enter the password of the Test account. Once the password validation is done, Notepad will be opened with the specified account credentials.

If you want to run programs or applications as a different user from Start Menu in Windows 10, you can do it by applying Group Policy settings. Do the following:-

Step 1. Open Local Group Policy Editor.

Step 2. In the Local Group Policy Editor window, navigate to the following path:-

User Configuration > Administrative Templates > Start Menu and Taskbar

Step 3. On the right-side pane of the “Start Menu and Taskbar” folder, double-click on the policy name Show “Run as different user” command on Start.

Step 4. Select Enabled.

Step 5. Click Apply.

Step 6. Click OK.

Now, right-click on any file on the Start menu that you want to run as a different user. Then, select the More option, and you will see a new option, “Run as different user.”

That’s all. Have fun!!!

Ever wanted to run a program as a different user from the start menu only to find out that it’s not possible on Windows 10? What if I told you that it’s possible to enable “Run as a Different User”?

You only need one small trick to do it and there are a couple of methods to execute it. To be honest, it was much easier to do that back in Windows 7/8.

To fix various Windows 10 problems, we recommend Outbyte PC Repair:
This software will repair common computer errors, protect you from file loss, malware damage, hardware failure, and optimise your computer for peak performance. In three simple steps, you can resolve PC issues and remove virus damage:

  1. Download Outbyte PC Repair Software
  2. Click Start Scan to detect Windows 10 issues that may be causing PC issues.
  3. Click Repair All to fix issues with your computer’s security and performance.
    This month, Outbyte has been downloaded by 26,078 readers.

Enable “Run as a Different User” The Vanilla Way

Did you know that it’s possible to use this feature without touching any settings at all? It’s a bit more tedious and not available directly in the start menu.

However, it’s still very useful if you’re only intending to rarely use it. That’s because you won’t have to mess with your registry or anything like that. You can follow the below steps to enable Run as a Different User in Windows 10.

All you have to do is:

  1. Open your start menu, shift + right click on a non-UWP program of your choice and open its File Location

    Open file location

  2. Shift + Right-click on the Program and you would get the “Run as a Different User” option in the Context Menu

    Run as a different user

The next methods which I’ll mention below actually enable the Run as a Different User feature for the Start Menu.

However, the process of enabling them can be much more tedious and even dangerous. It’s a good thing that you only have to go through it once. Unless you mess something up.

Do also keep in mind that for some reason, this feature is not available for UWP apps. UWP stands for Universal Windows Platform. Generally, every app that you can obtain from the Windows Store right now.

Use the Registry

Attention! When messing around with the registry, one wrong move can render your system unusable. And if that happens, I won’t take any responsibility for it.

It’s generally recommended to keep backups before touching your system files, just so that you can be on the safe side. Perform the below-mentioned steps at your own risk.

  • Open your taskbar search and type regedit
  • Then open the registry editor through it and do remember to do so with administrator permissions
  • Then navigate to ComputerHKEY_LOCAL_MACHINESOFTWAREPoliciesMicrosoftWindowsExplorer
  • If you can’t find the “Explorer” key, you can create it by clicking Edit -> New -> Key, and use Explorer as its name. That folder/key must be created under the “policies” key/folder.
  • At that point, you must create a new DWORD value which is named “ShowRunasDifferentuserinStart”.

    How to create the DWORD value:

  • Go to the Explorer key
  • Then click on Edit -> New -> DWORD (32-bit) Value.
  • Name it as “ShowRunasDifferentuserinStart
  • At last, insert “1” as its value data.
  • Windows 10: How to Enable "Run As a Different User" Feature on Start Menu
  • Then perform a reboot and you should be good to go.
    Here are the results of my own Windows 10 installation.
  • Windows 10: How to Enable "Run as a Different User" on Start Menu

You can now use this feature on your Windows 10 start menu with no problems whatsoever.

Use the Local Group Policy Director

This is a much easier way of enabling the Run as a Different User feature on your Start Menu. It also seems to be much more secure than messing around with the registry.

The only downside to it is that it’s only available for Windows 10 Professional, Education, and Enterprise. And once again, you’ll need administrator permissions.

Windows allows you to run applications from your account as a different user account as long as you have the credentials for the other account. This functionality is available in all of the versions of Windows i.e. Windows 7, 8, and 10. While we are covering Windows 10 only in this article, the same instructions can be followed in other versions as well. With the help of this feature, you can not only run applications that have the .exe extension, rather you can execute almost anything and every file extension that you can find. Be it batch files to different installers, you can run them as a different user.

Example of RunAs Program

This functionality is enabled by the RunAs program that comes built-in in Windows. The RunAs program is widely used for this purpose. This can be accessed through the command prompt along with the Windows Explorer, so if you prefer a graphical user interface, there is something for you as well. In order to make use of this program, there is a service that needs to be running in the background. The RunAs program depends on the Secondary Log-on service to be able to run various files as a different user. If the service is not running and is stopped, you won’t be able to achieve the intended result. Therefore, make sure that the service is running by looking for it in the Windows Services window.

As it turns out, there are several ways of running an application as a different user. We will be covering various different methods so you can choose to use any that you find easy and quick. With that said, let us get into it.

Method 1: Using the Windows Explorer

One way of running the application as a different user can be achieved through the Windows Explorer. This is rather one of the easiest ways of doing this as this coincides with the normal way of launching a program. Just the way you would launch a program on your current account, you can launch it from a different user account in the same manner. The only difference being you will have to choose a different option instead of double-clicking the application or choosing Open from the drop-down menu.

Now, in some cases, the required option to run a program as a different user may not be available to you in the drop-down menu. That is because of the Windows local policies. In such a case, you simply will have to change a policy in the Local Group Policy Editor window and you should be good to go. For this, follow the instructions down below:

  1. First of all, we will have to make sure that the “Run as different user” option is visible for you. For that, open up the Run dialog box by pressing the Windows key + R.
  2. Then, in the Run dialog box, type gpedit.msc and press the Enter key.
  3. This will open up the Local Group Policy Editor window. There, navigate to the following path:
Computer Configuration > Administrative Templates > Windows Components > Credential User Interface
  1. Then, on the right-hand pane, double-click on the Required trusted path for credential entry policy.
    Credential User Interface Policies
  2. Make sure that it is set to Not Configured. Click Apply and then hit OK.
    Require Trusted Path for Credential Entry Policy Settings
  3. Once you have done that, navigate to the directory where the application that you wish to run exists.
  4. Right-click on the application while pressing the Shift key and choose the “Run as different user” option from the drop-down menu.
    Running Notepad++ as Different User
  5. After that, provide the username and password of the other user account and click OK. Doing so will run the application as the provided user.

Method 2: Using the Command Prompt

Another way that you can use the RunAs program to run an application as a different user is through the command prompt. The RunAs utility can be used in the command prompt as you would use any other command. With the help of this, you can even create a batch file that will run a certain application for you as a different user every time you run it. To do this, follow the instructions down below:

  1. First of all, open up the Start Menu and then search for the command prompt to open it up.
  2. Once the command prompt window launches, enter the following command to run a program as a different user:
runas /user:USERNAME "PathToFile" UserPassword

Running Notepad as Admin
  1. Before pressing the Enter key, make sure to replace the USERNAME, PathToFile and UserPassword variables with their respective values.
  2. Once you have done that, press the Enter key and the program should run as the specified user.
  3. Additionally, you can create a batch file with the above command so you don’t have to open up the command prompt and enter the command every time you wish to run a program as a different user.
  4. To do this, create a text document and paste the above command inside the text document.
  5. After that, save the document as a batch file i.e. with a .bat extension.
  6. Now, every time you wish to launch the application, just run this .bat file and it’ll do the job for you.

Method 3: Using the Start Menu

Finally, you can also use the notorious Start Menu to run an application as a different user. However, in order to be able to do so, you will have to edit a policy within the Local Group Policy Editor window. Once you have done that, you will be able to see the “Run as different user” option when you right-click on the application in the Start Menu. To do this, follow the instructions down below:

  1. First of all, open up the Local Group Policy Editor by searching for it in the Start Menu.
  2. Once you have opened up the editor, make your way to the following path:
User ConfigurationAdministrative TemplatesStart Menu and Taskbar
  1. There, double-click on the Show “Run as different” command on Start policy on the right-hand pane.
    Start Menu Policy
  2. Set the policy to Enabled, click Apply and then hit OK.
    Editing Start Menu Policy Settings
  3. After doing that, go ahead and reboot your system so that the changes take effect.
  4. Once your PC boots up, search for an application in the Start Menu and then right-click on it. You should be able to see the “Run as a different user” option in the drop-down menu.
    Start Menu – Run as Different User

Photo of Kevin Arrows

Kevin Arrows

Kevin is a dynamic and self-motivated information technology professional, with a Thorough knowledge of all facets pertaining to network infrastructure design, implementation and administration. Superior record of delivering simultaneous large-scale mission critical projects on time and under budget.

Like this post? Please share to your friends:
  • Windows 10 ru en x86 x64 32in1 office 2019 by smokieblahblah
  • Windows 10 pro урезанная 64 бит
  • Windows 10 professional электронная лицензия купить
  • Windows 10 rtm core single language скачать
  • Windows 10 pro удалить магазин в windows