terminal
terminal copied to clipboard
The new 'Run as Administrator' feature returns a 'cannot find WindowsTerminal.exe' error
Windows Terminal version
1.13.10336.0
Windows build number
10.0.19044.1466
Other Software
No response
Steps to reproduce
Holding down Ctrl when clicking the + button to open a new window as admin opens the UAC prompt for elevation but after entering credentials, it returns an error saying WindowsTerminal.exe cannot be found.
Expected Behavior
No response
Actual Behavior
Windows cannot find 'C;\Program Files\WindowsApps\Microsoft.Windows.TerminalPreview_1.13.10336...\WindowsTerminal.exe'. Make sure you typed the name correctly, and then try again.
This most wanted mythic unicorn feature is still elusive
Same issue here. Windows Terminal Preview Version: 1.13.10336.0 Running on Windows 10 21H2 build 19044
I logged in as my admin user and installed Terminal Preview from the Store. That solved the issue for me.
I logged in as my admin user and installed Terminal Preview from the Store. That solved the issue for me.
I did something similar to solve the issue, logged in as admin user but just ran Terminal Preview and elevated a profile. Switched back to non admin user and was able to elevate a profile.
Edit: That only works after logging into the admin user and running it once. After a reboot, it continues to give the error until logging in with admin account and running it, then switching back to non-admin. I do not have it installed from the Microsoft store but installed using the msix file.
Logging in as the admin user and installing it from the Store isn't a viable solution as then every time the app is updated, you'd have to go and log in and update the app.
Logging in as the admin user and installing it from the Store isn't a viable solution as then every time the app is updated, you'd have to go and log in and update the app.
Is this true? I don't have enough experience with Store apps to know for sure, but they both run from the same directory in WindowsApps. I thought maybe "installing" it really just "enabled" it for the admin user since it's already installed but maybe it does maintain separate versioning on a per-user basis.
If that's the case, then you're right, it's not a proper solution but at least a workaround in the meantime?
Edit: Just updated my Skype app from the Store with my non-admin user and can confirm that it appears to have updated for all users on my machine. Hopefully the same would apply for future Terminal updates.
I'm facing a similar issue: the regular Microsoft Store is not available on our work machines. I seem to be unable to install Terminal in a way so that it will also be available to my admin account, which I only use via "run as admin" and entering credentials at the UAC prompt. Logging into admin accounts interactively is frowned upon. ☹️
Hi, we use ConfigMgr to deploy Applications and have linked the MSFB with ConfigMgr. So I installed it via ConfigMgr, which basically just triggers Store App, there is no offline package stored, and I could also do the run as admin command. However, when I received an update through the Store App I received the above mentioned error. So I uninstalled and reinstalled it again through SCCM and now it is back working. It is even the updated version... very wired
Oh that's a good idea! For folks that are hitting this, how did you install the Terminal? Maybe this is an issue with how scoop
/choco
/winget
/etc installs the Terminal?
I grabbed the msixbundle file for https://apps.microsoft.com/store/detail/windows-terminal-preview/9N8G5RFZ9XK3?hl=en-us&gl=US directly from the servers (using https://store.rg-adguard.net/) and installed it.
Hi,
unfortunately I cannot really see how is the app going to be installed through ConfigMgr
<![LOG[+++ Starting Install enforcement for App DT "WindowsStoreBSPDeeplinkDT_Windows Terminal - Windows app package (in the Windows Store)" ApplicationDeliveryType - ScopeId_1DBF7D30-A95F-45D9-9B8D-F59DDDC39387/DeploymentType_64c2eb8c-e84d-4521-8e34-12e2a5ef53b6, Revision - 1, ContentPath - , Execution Context - User]LOG]!><time="06:54:24.231-120" date="06-15-2022" component="AppEnforce" context="" type="1" thread="33372" file="appprovider.cpp:2094">
<![LOG[ The content path is not specified for DeploymentType ScopeId_1DBF7D30-A95F-45D9-9B8D-F59DDDC39387/DeploymentType_64c2eb8c-e84d-4521-8e34-12e2a5ef53b6. Content is assumed to be locally available.]LOG]!><time="06:54:24.231-120" date="06-15-2022" component="AppEnforce" context="" type="1" thread="33372" file="appprovider.cpp:2115">
<![LOG[Polling for installation status of Microsoft.WindowsTerminal_8wekyb3d8bbwe for up to 5 minutes.]LOG]!><time="06:54:27.656-120" date="06-15-2022" component="AppEnforce" context="" type="0" thread="33372" file="WmiBridgeCommon.cpp:139">
<![LOG[Installation state = 1, progress state = 0]LOG]!><time="06:54:27.673-120" date="06-15-2022" component="AppEnforce" context="" type="0" thread="33372" file="WmiBridgeCommon.cpp:170">
<![LOG[Installation state = 1, progress state = 0]LOG]!><time="06:54:28.690-120" date="06-15-2022" component="AppEnforce" context="" type="0" thread="33372" file="WmiBridgeCommon.cpp:170">
<![LOG[Installation state = 1, progress state = 0]LOG]!><time="06:54:29.720-120" date="06-15-2022" component="AppEnforce" context="" type="0" thread="33372" file="WmiBridgeCommon.cpp:170">
<![LOG[Installation state = 1, progress state = 0]LOG]!><time="06:54:30.747-120" date="06-15-2022" component="AppEnforce" context="" type="0" thread="33372" file="WmiBridgeCommon.cpp:170">
<![LOG[Installation state = 1, progress state = 0]LOG]!><time="06:54:31.777-120" date="06-15-2022" component="AppEnforce" context="" type="0" thread="33372" file="WmiBridgeCommon.cpp:170">
<![LOG[Installation state = 1, progress state = 0]LOG]!><time="06:54:32.807-120" date="06-15-2022" component="AppEnforce" context="" type="0" thread="33372" file="WmiBridgeCommon.cpp:170">
<![LOG[Installation state = 1, progress state = 0]LOG]!><time="06:54:33.833-120" date="06-15-2022" component="AppEnforce" context="" type="0" thread="33372" file="WmiBridgeCommon.cpp:170">
<![LOG[Installation state = 1, progress state = 0]LOG]!><time="06:54:34.864-120" date="06-15-2022" component="AppEnforce" context="" type="0" thread="33372" file="WmiBridgeCommon.cpp:170">
<![LOG[Installation state = 1, progress state = 0]LOG]!><time="06:54:35.900-120" date="06-15-2022" component="AppEnforce" context="" type="0" thread="33372" file="WmiBridgeCommon.cpp:170">
<![LOG[Installation state = 1, progress state = 0]LOG]!><time="06:54:36.931-120" date="06-15-2022" component="AppEnforce" context="" type="0" thread="33372" file="WmiBridgeCommon.cpp:170">
<![LOG[Installation state = 1, progress state = 0]LOG]!><time="06:54:37.953-120" date="06-15-2022" component="AppEnforce" context="" type="0" thread="33372" file="WmiBridgeCommon.cpp:170">
<![LOG[Installation state = 1, progress state = 45]LOG]!><time="06:54:38.973-120" date="06-15-2022" component="AppEnforce" context="" type="0" thread="33372" file="WmiBridgeCommon.cpp:170">
<![LOG[Installation state = 1, progress state = 90]LOG]!><time="06:54:40.007-120" date="06-15-2022" component="AppEnforce" context="" type="0" thread="33372" file="WmiBridgeCommon.cpp:170">
<![LOG[Installation state = 1, progress state = 90]LOG]!><time="06:54:41.033-120" date="06-15-2022" component="AppEnforce" context="" type="0" thread="33372" file="WmiBridgeCommon.cpp:170">
<![LOG[Installation state = 1, progress state = 90]LOG]!><time="06:54:42.052-120" date="06-15-2022" component="AppEnforce" context="" type="0" thread="33372" file="WmiBridgeCommon.cpp:170">
<![LOG[App Microsoft.WindowsTerminal_8wekyb3d8bbwe is installed successfully.]LOG]!><time="06:54:43.072-120" date="06-15-2022" component="AppEnforce" context="" type="1" thread="33372" file="WmiBridgeCommon.cpp:156">
<![LOG[+++ Enforce completed for ScopeId_1DBF7D30-A95F-45D9-9B8D-F59DDDC39387/DeploymentType_64c2eb8c-e84d-4521-8e34-12e2a5ef53b6, 1 using Package: Microsoft.WindowsTerminal____8wekyb3d8bbwe. Returning: 0]LOG]!><time="06:54:43.072-120" date="06-15-2022" component="AppEnforce" context="" type="1" thread="33372" file="appxhandler.cpp:635">
<![LOG[+++ AppX Install Info added. [AppDT Id: ScopeId_1DBF7D30-A95F-45D9-9B8D-F59DDDC39387/DeploymentType_64c2eb8c-e84d-4521-8e34-12e2a5ef53b6]]LOG]!><time="06:54:43.077-120" date="06-15-2022" component="AppEnforce" context="" type="1" thread="33372" file="appxhandler.cpp:353">
The App in ConfigMgr just looks like that:
ms-windows-store:PDP?PFN=Microsoft.WindowsTerminal_8wekyb3d8bbwe
Not an issue for me. Works fine.
I'm having similar problems as many here are having but I wanted to add more details of my specific situation in case this helps.
To me, the problem seems to happen because I am logged into a Windows 10 machine as a non-admin user that can't be elevated to have administrator rights.
I'm on a remote Windows 10 machine in a domain accessed through Remote Desktop (the modern Remote Desktop app) and a VPN. I normally log into this machine as a normal user that can't be elevated to have administrator permissions. In general for any program I want to run as an administrator when logged in as the non-admin user I get a UAC prompt where I have to enter the credentials of another user that does have administrator rights. This admin account (not called admin) was created specifically for me to use (similar admin accounts have been created for other users).
Initially I installed Windows Terminal from the Windows Store under the non-admin user. Discovering that I had to change the Windows PowerShell execution policy to RemoteSigned in order to use posh-git I tried to open an admin Terminal instance in order to run Set-ExecutionPolicy
. This is something that works fine on my local machine because the same user I use remotely is a local administrator on my local machine.
With no Windows Terminal instance already running, you can try to run Windows Terminal as an Administrator by right-clicking the Windows Terminal icon in the taskbar, right-clicking on 'Terminal' and selecting 'Run as administrator'. You can also right click the Terminal icon in the Start menu or 'Terminal' in the program list, select 'More' and then select 'Run as administrator'.
A Windows 10 UAC dialog with the title "Do you want to allow this app to make changes to your device?" appears where I must enter a user name and password. After clicking the 'Yes' button, the UAC prompt goes away then reappears again exactly the same. If I enter the same admin credentials again and click the 'Yes' button the UAC dialog goes away and I see the following dialog:
The above dialog says "Windows cannot find 'C:\Program Files\WindowsApps\Microsoft.WindowsTerminal_1.13.11431.0_x64__...\WindowsTerminal.exe'. Make sure you typed the name correctly, and then try again."
If a non-admin instance of Windows Terminal is already running, if you use any of the above methods of selecting 'Run as administrator' the UAC prompt will appear then go away once the 'Yes' button in clicked but nothing else happens after that.
If you use the Ctrl+click action on the 'Open new tab' control (the plus or + control) you see the UAC dialog once and then the same dialog.
The UAC dialog lists the program as "Unknown program" with a path of "C:\Program Files\WindowsApps\Microsoft.WindowsTerminal_1.13.11431.0_x64__8wekyb3d8bbwe\WindowsTerminal.exe". This does seem to be the path the Windows Terminal runs from in non-administrator mode.
If you install Windows Terminal from the Windows Store and run it under the admin user profile everything works smoothly and you only every have to click the 'Yes' button in the UAC prompt to launch an admin Windows Terminal window.
Installing Windows Terminal in the admin user profile does nothing to change the inability to launch Windows Terminal as the admin user from the non-admin user profile.
After spending several hours on this, I finally figured it out!
Windows Terminal is a Microsoft Store app. When the Windows Terminal app is installed from the MS Store, it is installed under the current user's context. If Windows Terminal is installed from a non-admin user's account and the user attempts to run it as admin, Windows is unable to find the executable because it has not yet been installed under the admin user's context.
To resolve the problem, simply install Windows Terminal for BOTH the admin user AND the non-admin user.
Now, when a non-admin user attempts to elevate privilege with the admin account, Windows will call the Windows Terminal installed under the admin user's context. Work's like a charm!
Work's like a charm!
Except it doesn't. Every time the app needs updating, you're going to have to sign into the secondary account and update it there. This is a typical poor implementation from MS not thinking about how an enterprise tool is actually being used by enterprises.
In win11 it is already installed and I still cannot runas admin.
Work's like a charm!
Except it doesn't. Every time the app needs updating, you're going to have to sign into the secondary account and update it there. This is a typical poor implementation from MS not thinking about how an enterprise tool is actually being used by enterprises.
As I replied to you above, I do not think you're correct with that assertion.
Hi,
after my Terminal got updated and the Run As Admin command wasn’t working again I checked your comments that it is not a Terminal issue but a Store issue. So I exported following keys from my normal user and imported them to my admin one and the Terminal went back working again.
However, I am not sure which keys I really needed and I also had to change the owner of the last reg key (5) to be able to import it. Well, I am not sure if this will help or someone feels bored to put it into a script, but it is really sad how MS designed the store.
terminal1.reg.txt terminal2.reg.txt terminal3.reg.txt terminal4.reg.txt terminal5.reg.txt
Edit: terminal5 seems to be enough:
`$wt_version = $null
Get-ChildItem -Path "C:\Program Files\WindowsApps" | Where-Object { $.Name -like "Microsoft.WindowsTerminal*"} | ForEach-Object { Get-ChildItem -Path $.FullName | Where-Object { $.Name -eq "WindowsTerminal.exe"} | ForEach-Object { $Matches = [Regex]::Matches($.DirectoryName, '[\d.]+'); if($Matches[1].Value -gt $wt_version){ $wt_version = $Matches[1].Value; } } }
if($wt_version -ne $null){
$regkey = "Registry::HKEY_CURRENT_USER\SOFTWARE\Classes\Local Settings\Software\Microsoft\Windows\CurrentVersion\AppModel\Repository\Families\Microsoft.WindowsTerminal_8wekyb3d8bbwe"
Write-Host $wt_version
if(Get-Item -Path $regkey){
$existkey = ([string](Get-ChildItem -Path $regkey | Select PSChildName).PSChildName)
if($existkey){
$newkey = $existkey -replace ([Regex]::Matches($existkey, '[\d\.]+').Value[1]), $wt_version
if($newkey -ne $existkey){
$sidobj = New-Object System.Security.Principal.SecurityIdentifier("S-1-5-32-544")
$acl = Get-Acl ($regkey )
$person = New-Object System.Security.Principal.NTAccount( $sidobj.Translate([System.Security.Principal.NTAccount]) )
$access = [System.Security.AccessControl.RegistryRights]"FullControl"
$inheritance = [System.Security.AccessControl.InheritanceFlags]"ContainerInherit,ObjectInherit"
$propagation = [System.Security.AccessControl.PropagationFlags]"None"
$type = [System.Security.AccessControl.AccessControlType]"Allow"
$rule = New-Object System.Security.AccessControl.RegistryAccessRule($person,$access,$inheritance,$propagation,$type)
$acl.AddAccessRule($rule)
$me = [System.Security.Principal.NTAccount]"$env:userdomain\$env:username"
$acl.SetOwner($me)
$acl | Set-Acl -Verbose
#Rename-Item -Path ($regkey + "\" + $existkey) -NewName $newkey -Force -Verbose
New-Item -Path $regkey -Name $newkey
New-ItemProperty -Path ($regkey + "\" + $existkey) -Name "Flags" -Value 1 -PropertyType DWord
}
}
}
}`
HUH I wonder if #14637 will help this... @jboelter thoughts?
@zadjii-msft I poked around at this a bit, forcing some failures by removing files, removing permissions, trying unprivileged user accounts, trying the non-store win10 build (unzipping in place). The various dialogs matched the failures I triggered. I don't have a Windows 10 machine around if it behaves differently.
e.g. removing permissions is different than missing files:

The logic to elevate seems sound as it's just substituting the module name from WindowsTerminal.exe
-> elevate-shim.exe
. The elevate shim reverses that back to WindowsTerminal.exe
.
Here's a work-around I came up with to create a desktop shortcut using PowerShell/pwsh to launch Windows Terminal as admin from a limited account. It should survive updates and not require you to install Windows Terminal via a privileged user account to launch it from a limited user's context.
$WshShell = New-Object -comObject WScript.Shell
$Shortcut = $WshShell.CreateShortcut("$env:USERPROFILE\Desktop\Windows Terminal (Admin).lnk")
$Shortcut.Arguments = "-NoProfile -NonInteractive -WindowStyle Hidden -Command Start-Process shell:AppsFolder\Microsoft.WindowsTerminal_8wekyb3d8bbwe!App -Verb RunAs"
$Shortcut.IconLocation = "$env:USERPROFILE\Pictures\Icons\Windows Terminal.ico"
$Shortcut.TargetPath = "pwsh.exe"
$Shortcut.Save()
Notes:
- I'm calling
pwsh
in$Shortcut.Arguments
and$Shortcut.TargetPath
but you can change this toPowerShell
/PowerShell.exe
if you don't have pwsh installed. - I'm using this .ico file for the shortcut: https://github.com/microsoft/terminal/issues/7682#issuecomment-695795199
I hope this helps.
Update:
- The command is more concise using the execution method mentioned here: https://github.com/microsoft/terminal/pull/14637#issue-1521564902
The following works for starting Windows Terminal with different user: runas /user:[[email protected]] "C:\Program Files\WindowsApps\Microsoft.WindowsTerminal_1.16.10262.0_x64__8wekyb3d8bbwe\wt.exe"
Use Double Quotes when you want to make a link: C:\Windows\System32\runas.exe /user:[[email protected]] "C:\Program Files\WindowsApps\Microsoft.WindowsTerminal_1.16.10262.0_x64__8wekyb3d8bbwe\wt.exe"
You can use "C:\Program Files\WindowsApps\Microsoft.WindowsTerminal_1.16.10262.0_x64__8wekyb3d8bbwe\wt.exe" for the Icon.
i have this issue, but If I have UAC behaviour of the elevation prompt set to prompt for credentials it prompts for login details twice and then fails to work but if I have UAC behaviour of the elevation prompt set to prompt for consent it works fine with administrator rights....
This didn't use to happen, I'm sure I've been able to run my current installation as Administrator as required without having to install two copies for admin and non-admin users. It's only recently I've hit this issue.
it looks like i can right click on a desired terminal profile inside windows terminal and select 'run as administrator' using Windows Terminal Preview Version: 1.20.10822.0 this i think i could not do before.... i only have one version installed
it looks like i can right click on a desired terminal profile inside windows terminal and select 'run as administrator'
That would be great, but it doesn't work for me. I can see that option and enter credentials when asked, but no new tab opens.
when i do it, i enter my credentials and a new window opwns with the new tab is in the new window are you using Version: 1.20.10822.0?
are you using Version: 1.20.10822.0
Ahh, no I'm still on 1.19.10821.0, the current Microsoft Store version.
in the microsoft store, try installing Windows Terminal Preview so you get the version i have and see if it works better? they can both be installed at the same time and you can remove each seperatly later depending on which you want to keep
@feldegast It worked on Windows Terminal Preview 1.20.10822.0, thanks very much :)