简体   繁体   English

计划的任务在Windows Server 2008 R2中不起作用

[英]Scheduled task not working in Windows Server 2008 R2

We have a Windows Script File X.wsf, which in turn will call Y.vbs. 我们有一个Windows脚本文件X.wsf,该文件又称为Y.vbs。 When we run X.wsf from the command window in Windows Server 2008 R2, either as "cscript X.wsf" or "X.wsf", it works fine. 当我们从Windows Server 2008 R2的命令窗口中以“ cscript X.wsf”或“ X.wsf”的形式运行X.wsf时,它可以正常工作。 However, if we create a task in Windows Scheduler and trigger X.wsf, the only thing that we see is "Running" status, but nothing seems to happen. 但是,如果我们在Windows Scheduler中创建任务并触发X.wsf,我们看到的唯一一件事就是“正在运行”状态,但似乎什么也没有发生。 The task will remain in "Running" status forever, but we don't see anything happening. 该任务将永远保持“正在运行”状态,但是我们什么也没看到。

Note that "Start In" in the task properties is already set to the folder containing X.wsf, and we also set it to run with SYSTEM and with "Run with highest privileges". 请注意,任务属性中的“开始于”已设置为包含X.wsf的文件夹,并且我们还将其设置为与SYSTEM一起运行,并与“以最高特权运行”一起运行。

In Windows Server 2003, the same task works just fine. 在Windows Server 2003中,相同的任务可以正常工作。 Also, we created a small .bat script and tested running it with a scheduled task in Windows Server 2008 R2, and it worked fine as well. 此外,我们创建了一个小的.bat脚本,并测试了它在Windows Server 2008 R2中与计划任务一起运行的情况,并且效果也很好。 So we suspect that Windows Scheduler must be behaving differently in Windows Server 2008 R2 for .wsf or .vbs files. 因此,我们怀疑Windows Scheduler在Windows Server 2008 R2中对.wsf或.vbs文件的行为必须不同。 Anyone know what the root cause is, and what is the solution? 任何人都知道根本原因是什么,解决方案是什么?

User, 用户,

I tried executing a wscript on a command session as well as a task session. 我尝试在命令会话以及任务会话上执行wscript。 Im able to execute from both the ways. 我能够从两种方式执行。

Make sure that you mention the correct path/filename in the trigger section. 确保在触发器部分中提到正确的路径/文件名。 Also make sure that you provide the complete path of the switch 还要确保您提供了交换机的完整路径

<Actions Context="Author">
  <Exec>
    <Command>C:\Windows\System32\wscript.exe</Command>
    <Arguments>u:\Scripts\test.vbs</Arguments>
  </Exec>
</Actions>

Let me know if this works. 让我知道这个是否奏效。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM