首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >查找计划任务向导任务信息的脚本

查找计划任务向导任务信息的脚本
EN

Stack Overflow用户
提问于 2014-06-24 19:15:08
回答 1查看 369关注 0票数 0

我知道有一个命令用于查找计算机的计划任务,但我希望获得更多关于计划任务本身的信息。我想知道什么时候和什么时候将执行计划的任务,以及计划任务的名称和区域。有什么想法吗?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2014-06-24 19:49:30

代码语言:javascript
运行
复制
Set TS = CreateObject("Schedule.Service")
TS.Connect("Serenity")

Set rootFolder = TS.GetFolder("\")

Set tasks = rootFolder.GetTasks(0)

If tasks.Count = 0 Then 
    Wscript.Echo "No tasks are registered."
Else
    WScript.Echo "Number of tasks registered: " & tasks.Count

    For Each Task In Tasks
    A=Task.Name
    A = A & " " & Task.NextRunTime
    wscript.echo A
    Next
End If

在帮助中,其中一些是带有其他信息的对象。

RegisteredTask

脚本对象,该对象提供用于立即运行任务的方法、获取正在运行的任务实例、获取或设置用于注册任务的凭据以及描述该任务的属性。

方法RegisteredTask对象定义以下方法。

代码语言:javascript
运行
复制
Method Description 
GetInstances Returns all instances of the registered task that are currently running. 
GetSecurityDescriptor Gets the security descriptor that is used as credentials for the registered task. 
GetRunTimes Gets the times that the registered task is scheduled to run during a specified time. 
SetSecurityDescriptor Sets the security descriptor that is used as credentials for the registered task. 
RunEx Runs the registered task immediately using specified flags and a session identifier. 
Stop Stops the registered task immediately. 
Run Runs the registered task immediately. 

属性RegisteredTask对象具有以下属性。

代码语言:javascript
运行
复制
Property Description 
Definition Gets the definition of the task. 
Enabled Gets or set a Boolean value that indicates if the registered task is enabled. 
LastRunTime Gets the time the registered task was last run. 
LastTaskResult Gets the results that were returned the last time the registered task was run. 
Name Gets the name of the registered task. 
NextRunTime Gets the time when the registered task is next scheduled to run. 
NumberOfMissedRuns Gets the number of times the registered task has missed a scheduled run. 
Path Gets the path to where the registered task is stored. 
State Gets the operational state of the registered task. 
XML Gets the XML-formatted registration information for the registered task. 

有关此脚本对象的更多信息和示例代码,请参见时间触发示例(脚本)和显示任务名称和状态(脚本)。

需求客户端需要Windows。类型库使用Taskschd.tlb。

DLL需要Taskschd.dll。

还请参阅任务计划程序对象任务计划程序

将有关此主题的评论发送到Microsoft

构建日期: 10/2/2006语言C++

显示所有需求客户端需要Windows。类型库使用Taskschd.tlb。

DLL需要Taskschd.dll。

还请参阅任务计划程序对象任务计划程序

将有关此主题的评论发送到Microsoft

建造日期:2006年2月10日

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/24394519

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档