简体   繁体   中英

How to check if a task with taskname is registered on task scheduler using powershell

I am creating task using powershell. Whenever i copy a task file(not the XML one, the one which get created by task scheduler itself) into Windows Task Library and try to import the same task,it says the task already exists . Refer below screenshot. 任务调度程序抛出的错误

But you can see i just copied the file in to the task scheduler library but yet not have imported it.

So, i like to know is there any way to find out if a task is already scheduled in tasklibrary?

One way is to go through the task library path and find out if the file is present or not but as you can see someone can just copy the file task library without importing it.

Is there any way to sort out this issue?

我通常使用schtasks /l /fo csv并按要查找的任务名称进行过滤。

使用“ SCHTASKS / Query”命令,它将显示所有已注册的TaskName及其下一个运行时和状态。

Get-ScheduledTask | Where-Object {$_.TaskName -eq "taskName"} -- Check if it is helpful or not

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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