简体   繁体   English

如何使用.NET Framework获取为Windows计划任务的触发器显示的文本?

[英]How can I get the text that is displayed for a trigger of a Windows scheduled task using .NET Framework?

as I learned today, by Get-ScheduledTask command in the PowerShell I can retrieve much information about a scheduled task, also its triggers by the Triggers property that is printed out according to the following pattern: 正如我今天所了解的那样,通过PowerShell中的Get-ScheduledTask命令,我可以检索有关计划任务的许多信息,也可以通过Triggers属性检索其触发信息,该属性根据以下模式打印出来:

Enabled            : True
EndBoundary        : 
ExecutionTimeLimit : 
Id                 : 
Repetition         : MSFT_TaskRepetitionPattern
StartBoundary      : 2016-03-06T03:00:00
DaysOfWeek         : 16
RandomDelay        : 
WeeksInterval      : 1
PSComputerName     : 

But in interests of a user-friendly output message, I would like to receive the display text you can see when watching the trigger in the Windows taskplaner: 但是出于用户友好的输出消息的考虑,我希望收到在Windows任务计划器中观看触发器时看到的显示文本:

学分:http://winaero.com/blog/wp-content/uploads/2016/08/Windows-10-the-list-of-triggers-600x344.png (Credits: http://winaero.com/blog/wp-content/uploads/2016/08/Windows-10-the-list-of-triggers-600x344.png ) (积分: http : //winaero.com/blog/wp-content/uploads/2016/08/Windows-10-the-list-of-triggers-600x344.png

So how can I extract the "details" text like "At log on of any user" by .NET Framework (in PowerShell)? 那么,如何通过.NET Framework(在PowerShell中)提取诸如“在任何用户登录时”之类的“详细信息”文本? I have not been able to found such member of the Get-ScheduledTask return type. 我尚未找到Get-ScheduledTask返回类型的此类成员。 (I have also taken a look at the .NET TaskScheduler class which seems though unfortunately only treat single processes' internals.) (我也看过了.NET TaskScheduler ,尽管不幸的是, 该类似乎只处理单个进程的内部。)

Do you know any way for this purpose? 你知道这个目的吗? Or do I have to generate the display text manually? 还是我必须手动生成显示文本?

Regards. 问候。

The details of tasks are available as XML (the XLM property of the returned task object). 任务的详细信息以XML(返回的任务对象的XLM属性)的形式提供。

$taskinfo = [xml](Get-ScheduledTask <taskname>).xml 
$taskinfo.task.triggers

Should provide information about the task triggers. 应该提供有关任务触发器的信息。

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

相关问题 如何使用 C# windows form .NET 框架获取仅显示在 MessageBox 中的名称? - How can I get the name only to show in the MessageBox using C# windows form .NET framework? 如何使用C#和.Net Framework获取Windows注册表项的真正价值? - How can I get the Really Value of the Windows Registry Keys by C# with .Net Framework? 如何使用C#启用/禁用计划任务? - How to get the enable / disable a scheduled task using C#? 使用Windows服务的计划任务实现 - Scheduled Task Implementation Using Windows Service 如何使用无服务器框架将参数传递给 schedule.Net lambda 函数? - How to pass parameters to scheduled .Net lambda functions using serverless framework? 使用C#访问Windows计划任务 - Accessing Windows Scheduled Task using C# 如何在(a)通过Windows任务计划的(b)和在WinForms应用程序中手动运行的(b)两者中运行一些通用代码? - How can I run some common code from both (a) scheduled via Windows Task & (b) manually from within WinForms app? 在.Net Core中使用计时器执行某些计划任务? - Using timer in .Net Core for some scheduled task? 如何在Windows 8上修复.NET Framework 4.0? - How can I repair .NET Framework 4.0 on Windows 8? 为Windows开发计划任务 - Developing a scheduled task for Windows
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM