Monitor Windows Scheduled Tasks under Main Task Library and other Sub-Folders
This is about monitoring the tasks scheduled in Windows Platform. Though there is a by-default monitoring available in SAM for the Tasks (when we do List Resource - it appears). But there is a limitation too.
The Limitation is - Solarwinds provides Task Monitoring feature only for the tasks under "Task Scheduler Library Folder (the parent folder)" only, not the other tasks under sun-folders (the child folders).
1. Tasks under Library Folder.
2. Tasks under Child Folder.
To monitor the scheduled tasks which are under sub-folders, I have written two scripts by taking reference from other developers post. These scripts will gather all the tasks name with status details and will store the result on a local path which is defined in the script (can be modified according to need). This script will bring both Parent Library Folder Tasks as well as the sub-folder tasks i.e. all scheduled jobs running on a Windows machine.
Results of the Script will give the number of tasks for each state as below-
3. Could Not Start
Reason for two scripts, details are as below -
Script -1 : This is based on "Get-ScheduledTask" cmdlet, which runs on new Windows platform coming with by-default Powershell. Some times like in older versions of Windows i.e. 2003 or 2008 that cmdlet is not recognized. For this reason I have created another script with different cmdlet, as below.
Script -2 : This is based on "schtasks.exe" cmdlet, which supports on the older versions of Windows as mentioned above to get the scheduled tasks details.
Based on the various statistics parameters value , you can create the alerts according to the requirement.
Note: The tasks details as mentioned above will be saved in ".csv" format with the filename based on the date and time the script will be executing. And that file will be stored on the local machine where the script is executed. So a user can go and check the historical data, even they can build the dashboard based on those files, if needed.
SolarWinds solutions are rooted in our deep connection to our user base in the THWACK® online community.
More than 150,000 members are here to solve problems, share technology and best practices, and directly
contribute to our product development process.
Learn more today by joining now.