GreenCan

List Scheduled Tasks in Task Scheduler Library

12 posts in this topic

This script will get all Scheduled tasks as defined on a system

There are basically 3 functions in this small udf:

  1. _TaskGetFolders() will return an array of all folders as from a given Scheduler Library folder, recursively. $aFolders will have to be declared before the function is called, I am not sure if there is a better method to avoid having to declare the array outside of _TaskGetFolders()...
  2. _TaskListAllDetailed() will return a detailed array of all tasks in a given task folder, recursively. This function is using _TaskGetFolders() for the recurse option.
  3. _TaskListToText() will create a formatted output of scheduled tasks as returned to the above array.

The script is complementary to taskplanerCOM.au3 by Allow2010.

The example shows

  • all folders in the Scheduler Library
  • All scheduled tasks in root (with formatted output)
  • All scheduled tasks on the system
  • Scheduled tasks Windows Defender if available

_TaskListAllDetailed.au3

 


Contributions

CheckUpdate - SelfUpdating script ------- Self updating script

Dynamic input validation ------------------- Use a Input masks can make your life easier and Validation can be as simple

MsgBox with CountDown ------------------- MsgBox with visual countdown

Display Multiline text cells in ListView ---- Example of pop-up or ToolTip for multiline text items in ListView

Presentation Manager ---------------------- Program to display and refresh different Border-less GUI's on a Display (large screen TV)

USB Drive Tools ------------------------------ Tool to help you with your USB drive management

Input Period udf ------------------------------ GUI for a period input

Excel ColorPicker ---------------------------- Color pickup tool will allow you to select a color from the standard Excel color palette

Excel Chart UDF ----------------------------- Collaboration project with water 

GetDateInString ------------------------------ Find date/time in a string using a date format notation like DD Mon YYYY hh:mm

TaskListAllDetailed --------------------------- List All Scheduled Tasks

Computer Info --------------------------------- A collection of information for helpdesk

Shared memory Demo ----------------------- Demo: Two applications communicate with each other through means of a memory share (using Nomad function, 32bit only)

Universal Date Format Conversion -------- Universal date converter from your PC local date format to any format

Disable Windows DetailsPane -------------- Disable Windows Explorer Details Pane

Oracle SQL Report Generator -------------  Oracle Report generator using SQL

SQLite Report Generator -------------------  SQLite Report generator using SQL

SQLite ListView and BLOB demo ---------- Demo: shows how binary (image) objects can be recognized natively in a database BLOB field

DSN-Less Database connection demo --- Demo: ActiveX Data Objects DSN-Less Database access

Animated animals ----------------------------- Fun: Moving animated objects

Perforated image in GUI --------------------- Fun: Perforate your image with image objects

UEZ's Perforator major update ------------- Fun: Pro version of Perforator by UEZ

Visual Crop Tool (GUI) ----------------------- Easy to use Visual Image Crop tool

Visual Image effect (GUI) -------------------- Visually apply effects on an image

 

 

 

Share this post


Link to post
Share on other sites



I get an error after the array window:

 

>Running:(3.3.13.19):C:\Program Files (x86)\AutoIt3\Beta\autoit3.exe "C:\_Downloads\_TaskListAllDetailed.au3"    
--> Press Ctrl+Alt+Break to Restart or Ctrl+Break to Stop
"C:\_Downloads\_TaskListAllDetailed.au3" (156) : ==> The requested action with this object has failed.:
$aResult[$iRows][14] = $oTaskAction.ClassId
$aResult[$iRows][14] = $oTaskAction^ ERROR
->15:13:11 AutoIt3.exe ended.rc:1
Br,

UEZ


Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

I get an error after the array window:

 

>Running:(3.3.13.19):C:\Program Files (x86)\AutoIt3\Beta\autoit3.exe "C:\_Downloads\_TaskListAllDetailed.au3"    
--> Press Ctrl+Alt+Break to Restart or Ctrl+Break to Stop
"C:\_Downloads\_TaskListAllDetailed.au3" (156) : ==> The requested action with this object has failed.:
$aResult[$iRows][14] = $oTaskAction.ClassId
$aResult[$iRows][14] = $oTaskAction^ ERROR
->15:13:11 AutoIt3.exe ended.rc:1
Br,

UEZ

 

Hi UEZ,

Just to be sure, are you using Windows XP or Vista/7 ?

I commented out _TaskIsValidPlatfrom() ...

The udf will only function for Task Scheduler 2.0 (Vista or above...)

Edited by GreenCan

Contributions

CheckUpdate - SelfUpdating script ------- Self updating script

Dynamic input validation ------------------- Use a Input masks can make your life easier and Validation can be as simple

MsgBox with CountDown ------------------- MsgBox with visual countdown

Display Multiline text cells in ListView ---- Example of pop-up or ToolTip for multiline text items in ListView

Presentation Manager ---------------------- Program to display and refresh different Border-less GUI's on a Display (large screen TV)

USB Drive Tools ------------------------------ Tool to help you with your USB drive management

Input Period udf ------------------------------ GUI for a period input

Excel ColorPicker ---------------------------- Color pickup tool will allow you to select a color from the standard Excel color palette

Excel Chart UDF ----------------------------- Collaboration project with water 

GetDateInString ------------------------------ Find date/time in a string using a date format notation like DD Mon YYYY hh:mm

TaskListAllDetailed --------------------------- List All Scheduled Tasks

Computer Info --------------------------------- A collection of information for helpdesk

Shared memory Demo ----------------------- Demo: Two applications communicate with each other through means of a memory share (using Nomad function, 32bit only)

Universal Date Format Conversion -------- Universal date converter from your PC local date format to any format

Disable Windows DetailsPane -------------- Disable Windows Explorer Details Pane

Oracle SQL Report Generator -------------  Oracle Report generator using SQL

SQLite Report Generator -------------------  SQLite Report generator using SQL

SQLite ListView and BLOB demo ---------- Demo: shows how binary (image) objects can be recognized natively in a database BLOB field

DSN-Less Database connection demo --- Demo: ActiveX Data Objects DSN-Less Database access

Animated animals ----------------------------- Fun: Moving animated objects

Perforated image in GUI --------------------- Fun: Perforate your image with image objects

UEZ's Perforator major update ------------- Fun: Pro version of Perforator by UEZ

Visual Crop Tool (GUI) ----------------------- Easy to use Visual Image Crop tool

Visual Image effect (GUI) -------------------- Visually apply effects on an image

 

 

 

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

I'm using Win 8.1 Enterprise.

Br,

UEZ

OK, I will test it on my 8.1 tablet later today...(no Autoit installed on this device unfortunately)

I'll come back to you afterwards.

Meanwhile, I checked msdn but there is nowhere mentioned that it would not work with 8.1

http://msdn.microsoft.com/en-us/library/windows/desktop/aa446821%28v=vs.85%29.aspx

Edited by GreenCan

Contributions

CheckUpdate - SelfUpdating script ------- Self updating script

Dynamic input validation ------------------- Use a Input masks can make your life easier and Validation can be as simple

MsgBox with CountDown ------------------- MsgBox with visual countdown

Display Multiline text cells in ListView ---- Example of pop-up or ToolTip for multiline text items in ListView

Presentation Manager ---------------------- Program to display and refresh different Border-less GUI's on a Display (large screen TV)

USB Drive Tools ------------------------------ Tool to help you with your USB drive management

Input Period udf ------------------------------ GUI for a period input

Excel ColorPicker ---------------------------- Color pickup tool will allow you to select a color from the standard Excel color palette

Excel Chart UDF ----------------------------- Collaboration project with water 

GetDateInString ------------------------------ Find date/time in a string using a date format notation like DD Mon YYYY hh:mm

TaskListAllDetailed --------------------------- List All Scheduled Tasks

Computer Info --------------------------------- A collection of information for helpdesk

Shared memory Demo ----------------------- Demo: Two applications communicate with each other through means of a memory share (using Nomad function, 32bit only)

Universal Date Format Conversion -------- Universal date converter from your PC local date format to any format

Disable Windows DetailsPane -------------- Disable Windows Explorer Details Pane

Oracle SQL Report Generator -------------  Oracle Report generator using SQL

SQLite Report Generator -------------------  SQLite Report generator using SQL

SQLite ListView and BLOB demo ---------- Demo: shows how binary (image) objects can be recognized natively in a database BLOB field

DSN-Less Database connection demo --- Demo: ActiveX Data Objects DSN-Less Database access

Animated animals ----------------------------- Fun: Moving animated objects

Perforated image in GUI --------------------- Fun: Perforate your image with image objects

UEZ's Perforator major update ------------- Fun: Pro version of Perforator by UEZ

Visual Crop Tool (GUI) ----------------------- Easy to use Visual Image Crop tool

Visual Image effect (GUI) -------------------- Visually apply effects on an image

 

 

 

Share this post


Link to post
Share on other sites

Hi GreenCan !

Works well on Windows 10x64 Technical Preview  :)


AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

Share this post


Link to post
Share on other sites

I'm using Win 8.1 Enterprise.

Br,

UEZ

Tried It on my 8.1 pro tablet and got no issue.

Can I suggest to comment out classid and check if the rest of the script works fine?


Contributions

CheckUpdate - SelfUpdating script ------- Self updating script

Dynamic input validation ------------------- Use a Input masks can make your life easier and Validation can be as simple

MsgBox with CountDown ------------------- MsgBox with visual countdown

Display Multiline text cells in ListView ---- Example of pop-up or ToolTip for multiline text items in ListView

Presentation Manager ---------------------- Program to display and refresh different Border-less GUI's on a Display (large screen TV)

USB Drive Tools ------------------------------ Tool to help you with your USB drive management

Input Period udf ------------------------------ GUI for a period input

Excel ColorPicker ---------------------------- Color pickup tool will allow you to select a color from the standard Excel color palette

Excel Chart UDF ----------------------------- Collaboration project with water 

GetDateInString ------------------------------ Find date/time in a string using a date format notation like DD Mon YYYY hh:mm

TaskListAllDetailed --------------------------- List All Scheduled Tasks

Computer Info --------------------------------- A collection of information for helpdesk

Shared memory Demo ----------------------- Demo: Two applications communicate with each other through means of a memory share (using Nomad function, 32bit only)

Universal Date Format Conversion -------- Universal date converter from your PC local date format to any format

Disable Windows DetailsPane -------------- Disable Windows Explorer Details Pane

Oracle SQL Report Generator -------------  Oracle Report generator using SQL

SQLite Report Generator -------------------  SQLite Report generator using SQL

SQLite ListView and BLOB demo ---------- Demo: shows how binary (image) objects can be recognized natively in a database BLOB field

DSN-Less Database connection demo --- Demo: ActiveX Data Objects DSN-Less Database access

Animated animals ----------------------------- Fun: Moving animated objects

Perforated image in GUI --------------------- Fun: Perforate your image with image objects

UEZ's Perforator major update ------------- Fun: Pro version of Perforator by UEZ

Visual Crop Tool (GUI) ----------------------- Easy to use Visual Image Crop tool

Visual Image effect (GUI) -------------------- Visually apply effects on an image

 

 

 

Share this post


Link to post
Share on other sites

The methods for $oActions = $oTaskDefinition.Actions (line 154-179) are not working running AutoIt v3.3.12.0.

For latest beta additionally $colTaskTriggers = $oTaskDefinition.Triggers is not working (line 273 - 290).

The rest seems to work.

Br,

UEZ


Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯

Share this post


Link to post
Share on other sites

The methods for $oActions = $oTaskDefinition.Actions (line 154-179) are not working running AutoIt v3.3.12.0.

For latest beta additionally $colTaskTriggers = $oTaskDefinition.Triggers is not working (line 273 - 290).

The rest seems to work.

Br,

UEZ

 

I tried it with both v3.3.10.2 and v3.3.12.0, no issue on my system. This is really weird as ClassId and Data are valid properties for the ComHandlerAction object.

http://msdn.microsoft.com/en-us/library/windows/desktop/aa446820(v=vs.85).aspx

ClassId results is something like this (extract from xml):  <ClassId>{CF2CF428-325B-48D3-8CA8-7633E36E5A32}</ClassId>

Idem for the trigger object.

http://msdn.microsoft.com/en-us/library/windows/desktop/aa383868%28v=vs.85%29.aspx

Not sure how I can help with this.


Does anyone else have the same issue as UEZ please?



Contributions

CheckUpdate - SelfUpdating script ------- Self updating script

Dynamic input validation ------------------- Use a Input masks can make your life easier and Validation can be as simple

MsgBox with CountDown ------------------- MsgBox with visual countdown

Display Multiline text cells in ListView ---- Example of pop-up or ToolTip for multiline text items in ListView

Presentation Manager ---------------------- Program to display and refresh different Border-less GUI's on a Display (large screen TV)

USB Drive Tools ------------------------------ Tool to help you with your USB drive management

Input Period udf ------------------------------ GUI for a period input

Excel ColorPicker ---------------------------- Color pickup tool will allow you to select a color from the standard Excel color palette

Excel Chart UDF ----------------------------- Collaboration project with water 

GetDateInString ------------------------------ Find date/time in a string using a date format notation like DD Mon YYYY hh:mm

TaskListAllDetailed --------------------------- List All Scheduled Tasks

Computer Info --------------------------------- A collection of information for helpdesk

Shared memory Demo ----------------------- Demo: Two applications communicate with each other through means of a memory share (using Nomad function, 32bit only)

Universal Date Format Conversion -------- Universal date converter from your PC local date format to any format

Disable Windows DetailsPane -------------- Disable Windows Explorer Details Pane

Oracle SQL Report Generator -------------  Oracle Report generator using SQL

SQLite Report Generator -------------------  SQLite Report generator using SQL

SQLite ListView and BLOB demo ---------- Demo: shows how binary (image) objects can be recognized natively in a database BLOB field

DSN-Less Database connection demo --- Demo: ActiveX Data Objects DSN-Less Database access

Animated animals ----------------------------- Fun: Moving animated objects

Perforated image in GUI --------------------- Fun: Perforate your image with image objects

UEZ's Perforator major update ------------- Fun: Pro version of Perforator by UEZ

Visual Crop Tool (GUI) ----------------------- Easy to use Visual Image Crop tool

Visual Image effect (GUI) -------------------- Visually apply effects on an image

 

 

 

Share this post


Link to post
Share on other sites

Same issue for me on Win 7

"O:\#   Tailored\#  Tech Toolz Code\Toolz\Scheduled Task Remover\_TaskListAllDetailed.au3" (156) : ==> The requested action with this object has failed.:
$aResult[$iRows][14] = $oTaskAction.ClassId
$aResult[$iRows][14] = $oTaskAction^ ERROR
->11:20:09 AutoIt3.exe ended.rc:1

Shows the first array then throws an error

Share this post


Link to post
Share on other sites

Share this post


Link to post
Share on other sites

Yep i went this way after some experimentation

Global $filename = '"' & @ScriptDir & '\Logs\tasklist_logs\' & @OSVersion & '-' & @UserName & '-' & @MDAY & '-' & @MON & '-' & @MIN & '-' & @SEC & '"'
RunWait(@ComSpec & ' /c ' & 'schtasks.exe /query /v /fo CSV >' &  $filename & '-tasklist.csv', '', @SW_HIDE)

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now

  • Similar Content

    • snoopy.pa30
      By snoopy.pa30
      I have a Windows 7 machine that is running a series of AutoIT 3 scripts from a master script. 
      When run manually, the entire set of scripts runs fine.  The scripts downloads data and do conversions and email results.
      When run from task scheduler, the  machine awakes and starts running the master script.  The first script runs fine, but the second part fails.  The first script is a simple call to an exe file that just runs.  The second script calls another exe file, but requires a few mouse clicks to run.  The further on scripts all run fine.
      When letting the script run from task scheduler (after being put to sleep) , if I move the mouse (or press a key), the login screen comes up (Strange, as No Password is set, and when machine boots, it comes straight into desktop).  If I click on the icon (no password) the scripts run fine.
      I am sure there is a setting somewhere that I have to set differently in task scheduler, or there is something in a W7 setting I need to change.
      My Task Scheduler quick tests are in the lines of: 
      Run only when user is logged on / Run whether user is logged on or not
      Run with Highest Privileges / or Not
      Configure for: (W7 / Vista / XP)
      Getting lost in the combinations, so will have to do a methodical series of tests, but hoping someone here might have some experience or suggestions.
      So, is it a Task Scheduler Setting (what combo) or a Windows 7 setting (what and where)?
      Any help or suggestion is appreciated.
      Thanks in Advance.
    • zorlar
      By zorlar
      Hi, I'm not professional autoit coder. I need to create a task. My software need to run when each computer starts and every day(Using task scheduler) I looked here 
       But I do not understand how the edit code in my request. My file path tempdir/clean.exe
      Also, Sorry my english not good. Thanks
    • Mian
      By Mian
      I wrote the following script. I have similar scripts to open internet explorer and excel when the user is not logged in and they work fine. The following script which opens an SSIS package and execute it is working fine when the user is logged in but stop working when the user is logged off. It stops after opening the SSIS package. I dont know why controlsend is working in the other two scripts but not in this one. Please help.
       
      ShellExecute("C:\Users\xyz\Desktop\exescripts\PackageToUploadDataToSqlServer.dtsx") sleep(5000) ControlSend("Execute Package Utility", "", "", "{TAB}") sleep(500) ControlSend("Execute Package Utility", "", "", "{TAB}") sleep(500) ControlSend("Execute Package Utility", "", "", "{TAB}") sleep(500) ControlSend("Execute Package Utility", "", "", "{TAB}") sleep(500) ControlSend("Execute Package Utility", "", "", "{ENTER}") sleep(50000) ControlSend("Package Execution Progress", "", "", "{TAB}") sleep(1000) ControlSend("Package Execution Progress", "", "", "{ENTER}") sleep(1000) ControlSend("Execute Package Utility", "", "", "{TAB}") sleep(1000) ControlSend("Execute Package Utility", "", "", "{TAB}") sleep(1000) ControlSend("Execute Package Utility", "", "", "{TAB}") sleep(1000) ControlSend("Execute Package Utility", "", "", "{TAB}") sleep(1000) ControlSend("Execute Package Utility", "", "", "{TAB}") sleep(1000) ControlSend("Execute Package Utility", "", "", "{TAB}") sleep(1000) ControlSend("Execute Package Utility", "", "", "{TAB}") sleep(1000) ControlSend("Execute Package Utility", "", "", "{TAB}") sleep(1000) ControlSend("Execute Package Utility", "", "", "{ENTER}") sleep(1000) Exit  
    • timmy2
      By timmy2
      My script is run by Task Scheduler at night. I want to leave a message for the user so he can see it the next day.  For users who remained logged in it's easy to leave a message on the screen, but that's impossible when the user is logged off when my task is run (my scripts runs fine; but no messages are displayed.  Is this due to something called "Session 0 Isolation"?)
      Is there a sure-fire way to detect if the system is sitting at the logon screen when my script is run by Task Scheduler?
      If my script knows it is running while the system is in this state it'll know what activities are impossible, like keyboard/mouse input, displaying messages, etc.
      (note Task Scheduler employs the user's credentials to run my script so checking for @username is of no help.)
       
    • shmuelw1
      By shmuelw1
      I tried to start Skype via Task Scheduler, but when it started, it only ran in the background. Then I made an AutoIt script to open the Start menu, type the path to Skype and press Enter. That also didn't work. The Task Schedular claimed the process started, but I didn't see anything happening.

      After doing some research, I found out that the problem was that I selected the checkbox in Task Scheduler to run the task even when I'm not logged in. When you do that, Task Scheduler runs the task in the background, so you can't see the started program.

      I didn't see anyone mention this on the forum, so I thought I'd mention this here.