Schtasks.exe to query within a Task Scheduler Library folder
I am getting familiar with using schtasks.exe for managing the Task Scheduler. One thing I would like to do is query within a single Task Scheduler folder. Schtasks.exe /query /S ServerName returns all tasks. If possible, what do I need to specify to only query the '/' (root) folder of the Task Scheduler Library? I tried Schtasks.exe /query /S ServerName/. It works, but only returns one task in the '/' folder for some reason. As a test, I also tried Schtasks.exe /query /S ServerName/Microsoft. That does not work. It sends /Microsoft as part of the server name, and I get network path not found. I could query for all tasks and perform a secondary step/script to gather only the tasks in the root folder, but I'd like to know if I can just query for those tasks using schtasks.exe.
June 22nd, 2010 10:36pm

Hi Brandon, As far as I know, the schtasks command does not have the ability to query within a Task Scheduler library folder. According to the TechNet link, the syntax of the "schtasks query" command is the following: http://technet.microsoft.com/en-us/library/cc725744(WS.10).aspx#BKMK_query schtasks [/query] [/fo {TABLE | LIST | CSV}] [/nh] [/v] [/s <Computer> [/u [<Domain>\]<User> [/p <Password>]]] The /s parameter is using to specify computer name or IP. It could not be extended to specify a particular folder. Term Definition /s <Computer> Specifies the name or IP address of a remote computer (with or without backslashes). The default is the local computer. Remarks The query operation lists all tasks that the user has permission to view. Administrators can view all tasks on the computer. Users can view only the tasks that they scheduled. From the above remark, we can see that this command is used to list all tasks that a user has permission to view. Currently, the customer needs to use script or other ways to parse the returned schedule tasks and retrieve those tasks in a particular folder. I understand that it would be better if the schtasks supports to retrieve tasks in a specific folder. We will forward your suggestions to corresponding department. Wilson Jia TechNet Subscriber Support in forum If you have any feedback on our support, please contact tngfb@microsoft.comThis posting is provided "AS IS" with no warranties, and confers no rights. Please remember to click Mark as Answer on the post that helps you, and to click Unmark as Answer if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.
Free Windows Admin Tool Kit Click here and download it now
June 23rd, 2010 8:53am

Thanks. I kind of figured that may be the case. What I found to be odd is that when I use a slash after the computer name, using the /S option, it doesn't return all tasks. It returns one task from the '/' folder. Well, anyways thanks again.
June 25th, 2010 6:34pm

I vote for this too If I run schtasks from a 2003 server, I get nothing. If I run it from a 2008 server, I get far too much. Is microsoft hinting that we should be using powershell instead?
Free Windows Admin Tool Kit Click here and download it now
July 12th, 2011 9:03am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics