psexec.exe在系统上下文中运行PowerShell脚本时会引发错误 - 错误在{MachineName}上创建键文件:访问被拒绝

发布于 2025-02-09 01:59:14 字数 803 浏览 2 评论 0原文

我试图使用PSEXEC在系统上下文中运行PowerShell脚本,但是获得错误,

C:\Users\{myUserName}>PsExec.exe -i -s "C:\windows\system32\WindowsPowerShell\v1.0\powershell.exe"

PsExec v2.34 - Execute processes remotely
Copyright (C) 2001-2021 Mark Russinovich
Sysinternals - www.sysinternals.com

Error creating key file on {MachineName}:
Access is denied.

这只是为了打开使用系统帐户的PowerShell终端。我的最终游戏是使用PSEXEC创建一个PBK文件,类似于

psexec.exe -i -s powershell.exe .\convertXML.ps1 -xmlFilePath .\vpntemplate.xml -ProfileName "TestVPN"

我使用的资源在此处使用配置Windows 10中的VPN设备隧道

I am trying to run a powershell script in the System context using PsExec, but get the error

C:\Users\{myUserName}>PsExec.exe -i -s "C:\windows\system32\WindowsPowerShell\v1.0\powershell.exe"

PsExec v2.34 - Execute processes remotely
Copyright (C) 2001-2021 Mark Russinovich
Sysinternals - www.sysinternals.com

Error creating key file on {MachineName}:
Access is denied.

This is simply to open up a PowerShell terminal with the system account. My end game is to use PsExec to create a PBK file like this

psexec.exe -i -s powershell.exe .\convertXML.ps1 -xmlFilePath .\vpntemplate.xml -ProfileName "TestVPN"

I am using the resources referenced here Configure VPN device Tunnels in WIndows 10

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

茶花眉 2025-02-16 01:59:14

@zett42当我打开命令窗口以管理员的身份并尝试您的命令时,它会按照我的预期工作。

psexec.exe -i -s powershell.exe -noprofile

另外,我认为正是Psexec的Eula引起了问题,因为我跑了这个,而且效果也很完美

psexec.exe -i -s powershell.exe -nobanner -accepteula

@zett42 when I opened a command window as an administrator and tried your command, it worked as I expected.

psexec.exe -i -s powershell.exe -noprofile

Alternatively, I think it was psexec's EULA that was causing problems because I ran this and it worked flawlessly as well

psexec.exe -i -s powershell.exe -nobanner -accepteula
日暮斜阳 2025-02-16 01:59:14

这可能是原因:
PSEXESVC.EXE被攻击表面降低(ASR)规则所阻挡“源自PSEXEC和WMI命令的块过程创建”。

This can be the cause:
PSEXESVC.exe was blocked by the attack surface reduction (ASR) rule "Block process creations originating from PSExec and WMI commands"

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文