schtasks /create /tn "Report monthly id 700" /tr "some path" /SC ONEVENT /EC Application /MO *[Application/EventID=700]
我收到消息
SUCCESS: The scheduled task "testReport monthly id 700" has successfully been created.
但是我在Task Scheduler中找不到它。有什么建议吗?
答案 0 :(得分:0)
我发现了一篇关于计划任务可见性的有趣文章: https://michlstechblog.info/blog/windows-run-task-scheduler-task-as-limited-user/
使用上述代码,任务变得可见甚至可执行:
$scheduler = New-Object -ComObject "Schedule.Service"
$scheduler.Connect()
$task = $scheduler.GetFolder("").GetTask("")
$sec = $task.GetSecurityDescriptor(0xF)
$sec = $sec + '(A;;GRGX;;;AU)'
$task.SetSecurityDescriptor($sec, 0)
也许它会帮助别人