Windows 11 22H2 更新后使用具有信任级别的 runas 时出现“参数不正确”

Sto*_*Foo 6 powershell administrator runas windows-11 windows-11-v22h2

我有一个脚本需要以管理员身份运行,但然后在非提升的上下文中运行单个命令。我之前使用的是runas /trustlevel:0x20000 program.exe,但在将 Windows 11 更新到 22H2 后,该命令现在给出以下输出(此处以运行记事本为例):

PS > runas /trustlevel:0x20000 notepad
RUNAS ERROR: Unable to run - notepad
87: The parameter is incorrect.
Run Code Online (Sandbox Code Playgroud)

我已经仔细检查了 trustlevel 参数值,它似乎是正确的:

PS > runas /showtrustlevels
The following trust levels are available on your system:
0x20000 (Basic User)
Run Code Online (Sandbox Code Playgroud)

我尝试的任何应用程序都会发生这种情况,而不仅仅是记事本或我的脚本中的应用程序。我还在 Powershell 7、Windows Powershell (5) 和命令行中尝试过,但没有区别。Runas 本身并没有完全损坏,正如我可以做到的runas /profile /env /user:<username> notepad,它会启动(输入我的密码后)。我也做了sfc /scannow以防万一的事情,但这没有什么区别。

我目前正在尝试弄清楚是否有什么我可以在这里做的,或者该功能是否刚刚在 22H2 被弃用。

小智 3

这是最新 Windows 11 更新的一个已知问题。该问题已在预览版 25247 中得到解决:

\n
\n

修复了导致 runas 命令在某些情况下意外失败的问题,错误 87 表示参数不正确(当参数为 \xe2\x80\x99t 时)。

\n
\n

https://blogs.windows.com/windows-insider/2022/11/18/announcing-windows-11-insider-preview-build-25247/

\n