reporting on scheduled tasks - reporting on scheduled tasks

Posted: Friday, March 22, 2019 5:25:22 PM(UTC)


Member Alpha Tester Original PosterPosts: 236
running LS version and I don't see a report on scheduled tasks. Wondering if LS scans those or not.

I found a way to do a report in powershell but it would be cleaner and better in LANSweeper for sure.

Here is the powershell

param (
[string[]] $ComputerName = $env:computername,
## Get-ADComputer -Filter * | Select -Expand Name
[string] $TaskName
#function to get all scheduled task folder details.
function Get-TaskSubFolders {
param (
$ArrFolders = @()
$folders = $folderRef.getfolders(1)
if($folders) {
foreach ($folder in $folders) {
$ArrFolders = $ArrFolders + $folder
if($folder.getfolders(1)) {
Get-TaskSubFolders -FolderRef $folder
return $ArrFolders

#$ComputerName = Get-ADComputer -Filter * | Select -Expand Name

foreach ($Computer in $ComputerName) {
$SchService = New-Object -ComObject Schedule.Service
$Rootfolder = $SchService.GetFolder("\")
$folders = @($RootFolder)
$folders += Get-Tasksubfolders -FolderRef $RootFolder
foreach($Folder in $folders) {
$Tasks = $folder.gettasks(1)
foreach($Task in $Tasks) {
$OutputObj = New-Object -TypeName PSobject
$OutputObj | Add-Member -MemberType NoteProperty -Name ComputerName -Value $Computer
$OutputObj | Add-Member -MemberType NoteProperty -Name TaskName -Value $Task.Name
$OutputObj | Add-Member -MemberType NoteProperty -Name TaskFolder -Value $Folder.path
$OutputObj | Add-Member -MemberType NoteProperty -Name IsEnabled -Value $task.enabled
$OutputObj | Add-Member -MemberType NoteProperty -Name LastRunTime -Value $task.LastRunTime
$OutputObj | Add-Member -MemberType NoteProperty -Name LastTaskResult -Value $task.LastTaskResult
$OutputObj | Add-Member -MemberType NoteProperty -Name NextRunTime -Value $task.NextRunTime
$OutputObj | Add-Member -MemberType NoteProperty -Name State -Value $task.State
$OutputObj | Add-Member -MemberType NoteProperty -Name TaskFolderPath -Value $task.Path

if($TaskName) {
if($Task.Name -eq $TaskName) {
} else {



Save it as a file called findscheduledtasks.ps1
then you can run it in powershell (I used an administrative powershell just in case)

.\findscheduledtasks.ps1 | ConvertTo-Html -Property ComputerName,TaskName,Folder,IsEnabled,State,LastRunTime,LastTaskResult,NextRunTime, TaskFolderPath -Head $Header | Out-File -FilePath scheduledtasks.html

The Output is a file in your folder called "Scheduledtasks.html" open in your browser and you get a table from your local system scheduled tasks.

uncomment this line "#$ComputerName = Get-ADComputer -Filter * | Select -Expand Name" and it will scan all systems from AD that you have access too, that could take a while.

WARNING, I cobbled together several scripts and examples I found on the web to make this work. I am not very good at Powershell and even worse at HTML, there is a lot to improve upon, which is why I was thinking LS could do this

Forum Admins, if you don't like this post or feel it is miscategorized etc, feel free to move/delete it and let me know.
#1Esben.D Member Administration Posts: 1,982  
posted: 3/25/2019 9:21:28 AM(UTC)
It's not possible at the moment, the only way I can think of doing it by using Lansweeper would be to write the info the script gathers in registry keys and scan those.
#2AZHockeyNut Member Alpha Tester Original PosterPosts: 236  
posted: 3/25/2019 7:45:34 PM(UTC)
OK I think what I might do is make a report in html that is what I am looking for then attach that to a tab on the dashboard for now until you guys get it into the app (assuming some day you will). :)
#3vqT4cDoP9iXyMZwoDUWU Member Posts: 17  
posted: 9/15/2020 4:54:02 PM(UTC)
Just checking in, has there been any further development from Lansweeper on collecting Scheduled Task information or is this in the roadmap?
#4Hendrik.VE Member Posts: 45  
posted: 9/16/2020 8:23:44 AM(UTC)
We use the following workaround to see the scheduled tasks in Lansweeper:

- Run the following simple PowerShell oneliner (eg. using deployment):

Get-ScheduledTask -TaskPath "\" | Get-ScheduledTaskInfo | % {$str = "TaskName : " ;$str += $_.TaskName; $str += " ; Lastruntime : ";$str += $_.Lastruntime; $str += " ; LastTaskResult : "; $str += $_.LastTaskResult; EventCreate /so SchedTask /L Application /T Error /ID 1000 /D $str}

- Rescan your asset(s) and check the Event log tab

We didn't create any report yet as we only use this workaround 'on the fly' to collect specific information.

PS. instead of using the deployment feature we use McAfee ePO to run PowerShell or other scripts. No credentials or other complex configuration needed. If you want to collect the output from your scripts you can parse it either to a (custom) registry key or to the Event Log.

Active Discussions

Lansweeper Lansweeper Errors - Licencing and scanning
by  dnkleaf   Go to last post Go to first unread
Last post: Yesterday at 1:02:13 PM(UTC)
Lansweeper Search for Blank Fields
by  CS Caritas Socialis IT  
Go to last post Go to first unread
Last post: Yesterday at 12:19:05 PM(UTC)
Lansweeper Uninstalled software still listed
by  Dennis Gewillig   Go to last post Go to first unread
Last post: Yesterday at 9:19:19 AM(UTC)
Lansweeper Software deployment initiated by user
by  LS_enthusiast_4444   Go to last post Go to first unread
Last post: 11/26/2020 9:28:18 PM(UTC)
Lansweeper Help Desk not disabling for regular users?
by  FrankSc  
Go to last post Go to first unread
Last post: 11/26/2020 8:18:38 PM(UTC)
Lansweeper Satisfaction Questionnaire after ticket close
by  mouaad   Go to last post Go to first unread
Last post: 11/26/2020 4:31:44 PM(UTC)
Lansweeper Microsoft EDGE browser support
by  Vapoured  
Go to last post Go to first unread
Last post: 11/26/2020 4:54:30 AM(UTC)