[英]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任务计划器中观看触发器时看到的显示文本:
(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.