Error 0xd0000022 when launching any shell (PS, cmd, git bash, PS7, Azure Cloud Shell) in WT
Environment
Windows build number 10.0.18363.0
Windows Terminal (Unpackaged)
Version: 1.0.200629001-release1.0
Steps to reproduce
Run the terminal without admin privileges and open any cli (powershell, cmd, git bash - whatever)
Expected behavior
Terminal opens shells
Actual behavior
[error 0xd0000022 when launching powershell.exe']
[error 0xd0000022 when launching cmd.exe']
[error 0xd0000022 when launching "%PROGRAMFILES%\git\usr\bin\bash.exe" -i -l']
[error 0xd0000022 when launching C:\Program Files\PowerShell\7\pwsh.exe']
Additional info
I tried to open with full path to powershell, to shortcut, created the profile, none of that worked. Actually, any of the programs I tried to run in WT - did not work. I have read/write access to the folder I have WT in. I have access to the folder the powershell starts in I am now using unpacked version instead of installed - both of them not working. To open the shell you need to run WT as admin and this is actually not acceptable for me.
I was about to move to WT, but ConEmu still wins with it, for now. It's opening any shell like a charm.
I attached ConEmu that runs powershell without admin rights and Windows Terminal that runs the same command and doesn't work.

I'd like to add, that my PATH has entries with system32 - both in LocalMachine and CurrentUser scopes. When I run powershell command in Run - it works like a charm.
Any of the solution in existing issues did not work for me
Well that's just the damndest thing I've ever heard. I have no idea why the Terminal would be failing to launch processes unelevated for you. Especially if they work jut fine in ConEmu, or a standard conhost window.
probably irrelevant: 0xc0000022 is STATUS_ACCESS_DENIED, which isn't terribly helpful. That's what our internal error search returns for 0xd0000022, along with a message about how this was probably an NTSTATUS code (converted using HRESULT_FROM_NT).
Do you have anything installed that might be hooking conhost.exe launches? Does git bash's default terminal emulator work unelevated, and can that spawn powershell, cmd? I'm really just spitballing for anything here.
I have programs installed that I thought are blocking the WT behavior (I work in banking company so we have limitations), yet I've got all the "guarding" software uninstalled with the company admins and absolutely nothing has changed. ConEmu still works, WT still doesn't.
The only way I can get the WT to work is running it with elevated privileges.
Just straight out of curiosity, I ran git bash from ConEmu and run powershell from it. Works like a charm :)

What about if you don't involve conemu at all? What happens when you launch those applications from a standard cmd.exe window? Or what about from the terminal that ships with Git Bash (mintty)?


Works a-ok
Since you're running unpackaged...
does it work if you double-click OpenConsole in the WT folder? It won't be the Terminal itself, but it will verify that one of its components works properly.
Doesn't work until I run it as administrator.
That's bizarre. Are there any weird permissions set on that OpenConsole.exe? There shouldn't be, but maybe there's something corrupted with the installation.
No, I've downloaded new bundle, unpacked it and ran OpenConsole.exe from it. Same result.
I don't know if it's related, but I've started to see problems with vs code console - maybe this will guide you: 14.07.2020 09:25:59 [NORMAL] - pwsh.exe started. 14.07.2020 09:25:59 [NORMAL] - Waiting for session file 14.07.2020 09:29:59 [NORMAL] - Timed out waiting for session file to appear. 14.07.2020 09:29:59 [NORMAL] - Language server startup failed. 14.07.2020 09:29:59 [ERROR] - The language service could not be started: 14.07.2020 09:29:59 [ERROR] - Error: Timed out waiting for session file to appear.
That's just in: WSL doesn't work either:

and ConEmu:

I've downloaded new bundle, unpacked it and ran OpenConsole.exe from it. Same result.
That's definitely unexpected. All of the Terminal tabs are run through OpenConsole.exe, so it makes sense that if that doesn't work, then the Terminal won't be able to launch anything.
Does renaming OpenConsole.exe to something else, like maybe conhost.exe, allow you to launch that exe?
This is a really dumb idea, and it's definitely going to work poorly, but can you copy-paste conhost.exe from C:\windows\system32 into the Terminal install, and rename it to OpenConsole.exe, and have that launch successfully? conhost and OpenConsole are the same binary, but the OpenConsole version is quite a bit more up to date.
fwiw i have the same issue with terminal and 0xd000022 and all shells under it. Works as admin. I had recently upgraded to win10 2004, I had to install terminal via Add-AppxPackage. after installing terminal vscode is also now failing to open powershell7 without admin privileges...
related #5488
This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment.
Does renaming OpenConsole.exe to something else, like maybe conhost.exe, allow you to launch that exe?
No. I've changed OpenConsole.exe to conhost.exe, doesn't work until I run it as admin.
This is a really dumb idea, and it's definitely going to work poorly, but can you copy-paste conhost.exe from C:\windows\system32 into the Terminal install, and rename it to OpenConsole.exe, and have that launch successfully? conhost and OpenConsole are the same binary, but the OpenConsole version is quite a bit more up to date.
No success. Still the same error.
BTW. I've requested once again to my corporate admins to check on their side in parallel.
Check cacls openconsole.exe /s. The /s option returns SDDL, which includes conditional access-allow entries (XA) such as (XA;ID;0x1200a9;;;BU;(WIN://SYSAPPID Contains "Microsoft.WindowsTerminalPreview_8wekyb3d8bbwe"). The latter grants the given access (0x0012_00a9) to users (BU) only if their access token contains the particular "WIN://SYSAPPID" attribute value.
Ok, after digging through crap tons of logs I found out where the dragon lies. So - I've got EPM software installed since I need to have "secured" station.
So the thing is - I need you guys (from Microsoft) to try to find solution to not run ANYTHING that requires elevated privileges. I checked under every rock - every shortcut of mine is running without admin - yet still it's being blocked as malware.
Plz fix, as I really dig the new Terminal and its a bummer I can't use it.
I've also made a task in vs code repo: https://github.com/microsoft/vscode/issues/103562 as it's connected with the same reason behind both of these issues.
Well, that's still bizarre. Unless you're running the Terminal as elevated, we're not going to be doing anything that requests any other permissions. This isn't the first time that the Windows Terminal has been erroneously flagged by some faulty 3rd party AV software. I'd probably follow up with the EPM vendor to get this fixed on their end.
So I think I've narrowed this down to something to do with conpty vs winpty, as I can toggle vscode to use winpty and I no longer require elevating. I'm not yet sure what's seeing conpty as requiring elevation, no doubt some sort of corporate 'security' software.