我如何“运行”? “网络服务”?
我正在尝试作为另一个帐户运行一个进程。我有命令:
runas "/user:WIN-CLR8YU96CL5\network service" "abwsx1.exe"
但这会要求输入密码。但网络服务没有设置密码。
我想做的事情可能吗?
I am trying to run a process as another account. I have the command:
runas "/user:WIN-CLR8YU96CL5\network service" "abwsx1.exe"
but then this asks for the password. However there is no password set for the network service.
Is what I am trying to do possible?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
使用 SysInternals 中的 PsExec.exe,从提升的命令提示符运行。
例如,这将打开一个作为网络服务运行的新命令提示符:
这将作为本地系统运行:
您可以通过从 cmd 提示符运行
whoami
来验证这些。另请参阅:
http://forum.sysinternals .com/how-to-start-cmdexe-as-network-service_topic15797.html
交互式命令提示符作为网络服务
Use PsExec.exe from SysInternals, running from an elevated command prompt.
e.g. this will open a new command prompt running as NETWORK SERVICE:
this will run it as LOCAL SYSTEM:
You can verify these by running
whoami
from the cmd prompt.See also:
http://forum.sysinternals.com/how-to-start-cmdexe-as-network-service_topic15797.html
Interactive command prompt as NETWORK SERVICE
在任务计划程序中,创建一个任务以在 NETWORK SERVICE 用户下运行应用程序。
然后,您可以使用命令行运行任务
,其中 taskname 是任务的名称。
In Task Scheduler, create a task to run the application under the NETWORK SERVICE user.
You can then run the task from the command line using
Where taskname is the name of your task.
通常,您只能模拟 Windows 服务中的服务帐户,例如 这篇文章提到:
如果您尝试在自己的用户上下文中执行此操作,则此类尝试应该会失败。
You can only impersonate as service account from a Windows service typically, like this post mentions:
If you try to do that in your own user context, then such attempts should fail.
我已经在 PsExec64-v2.2 上进行了测试
,
对于 win10-home-x64-10.0.14393 和 win10-pro-x64-10.0.15063 使用普通控制台失败了,使用提升的控制台工作正常
I have tested
and
on PsExec64-v2.2, for win10-home-x64-10.0.14393 and win10-pro-x64-10.0.15063 to use normal console it's failed, use elevated console it works fine
我知道这是一个旧线程,但它是此问题的首要结果,我希望能够使用 PowerShell 运行命令,而无需在我们的 Windows Server 上安装任何其他工具。我想出了以下 PowerShell 脚本,该脚本创建计划任务、运行它,然后删除它。它还允许您在不同的用户帐户下运行该命令。
I know this is an old thread but it is the top result for this problem and I wanted to be able to run a command using PowerShell without having to install any additional tools on our Windows Server. I came up with the following PowerShell script that creates a scheduled task, runs it, and then deletes it. It is also written to allow you to run the command under different user accounts.