如何在本地系统帐户下运行 CMD.exe? [英] How do you run CMD.exe under the Local System Account?

查看:27
本文介绍了如何在本地系统帐户下运行 CMD.exe?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在运行 Vista,我想手动完成与我的 Windows 服务相同的操作.由于 Windows 服务在本地系统帐户下运行,我想模拟相同的行为.基本上,我想在本地系统帐户下运行 CMD.EXE.

I'm currently running Vista and I would like to manually complete the same operations as my Windows Service. Since the Windows Service is running under the Local System Account, I would like to emulate this same behavior. Basically, I would like to run CMD.EXE under the Local System Account.

我在网上找到了建议使用 DOS 任务计划程序 AT 命令启动 CMD.exe 的信息,但我收到了 Vista 警告,由于安全性增强,此任务将在例外时间运行,但不能以交互方式运行."这是一个示例命令:

I found information online which suggests lauching the CMD.exe using the DOS Task Scheduler AT command, but I received a Vista warning that "due to security enhancements, this task will run at the time excepted but not interactively." Here's a sample command:

AT 12:00 /interactive cmd.exe

另一种解决方案建议通过仅启动 CMD.exe 的服务控制 (sc.exe) 创建辅助 Windows 服务.

Another solution suggested creating a secondary Windows Service via the Service Control (sc.exe) which merely launches CMD.exe.

C:\sc create RunCMDAsLSA binpath= "cmd" type=own type=interact
C:\sc start RunCMDAsLSA

在这种情况下,服务无法启动并导致以下错误消息:

In this case the service fails to start and results it the following error message:

FAILED 1053: The service did not respond to the start or control request in a timely fashion.

第三个建议是通过计划任务启动 CMD.exe.尽管您可能会在各种帐户下运行计划任务,但我不认为本地系统帐户是其中之一.

The third suggestion was to launch CMD.exe via a Scheduled Task. Though you may run scheduled tasks under various accounts, I don't believe the Local System Account is one of them.

我也尝试过使用 Runas,但认为我遇到了与运行计划任务时相同的限制.

I've tried using the Runas as well, but think I'm running into the same restriction as found when running a scheduled task.

到目前为止,我的每一次尝试都以失败告终.有什么建议吗?

Thus far, each of my attempts have ended in failure. Any suggestions?

推荐答案

虽然我没有亲自测试过,但我有充分的理由相信上述 AT COMMAND 解决方案适用于 XP、2000 和 Server 2003.根据我的和 Bryant 的测试,我们发现相同的方法不适用于 Vista 或 Windows Server 2008——很可能是由于增加了安全性和/interactive 开关被弃用.

Though I haven't personally tested, I have good reason to believe that the above stated AT COMMAND solution will work for XP, 2000 and Server 2003. Per my and Bryant's testing, we've identified that the same approach does not work with Vista or Windows Server 2008 -- most probably due to added security and the /interactive switch being deprecated.

但是,我遇到了这篇文章 演示了 SysInternals(2006 年 7 月被微软收购.)我通过以下方式启动了命令行,突然间我像魔法一样在本地管理员帐户下运行:

However, I came across this article which demonstrates the use of PSTools from SysInternals (which was acquired by Microsoft in July, 2006.) I launched the command line via the following and suddenly I was running under the Local Admin Account like magic:

psexec -i -s cmd.exe

PSTools 运行良好.它是一套轻量级的、文档齐全的工具,可为我的问题提供适当的解决方案.

PSTools works well. It's a lightweight, well-documented set of tools which provides an appropriate solution to my problem.

非常感谢提供帮助的人.

Many thanks to those who offered help.

这篇关于如何在本地系统帐户下运行 CMD.exe?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆