Get scheduled tasks from remote computer

This script uses the Schedule.Service COM-object to query the local or a remote computer in order to gather a formatted list including the Author, UserId and description of the task. This information is parsed from the XML attributed to provide a more human readable format.

4.5 Star
43,107 times
Add to favorites
Operating System
E-mail Twitter Digg Facebook
  • Exception when calling "Connect" E_ACCESSDENIED
    3 Posts | Last post July 18, 2019
    • I use the script in one SCCM-Baseline to find a local task an to output the name of the task. It works fine, if the Notebooks in the local network in the Office. If the Notebooks connected via VPN it comes to a mistake. I Think the problen ist the firewall. With which setting it should work?
      Error in German from SCCM-Client:
      ScriptProvider::CreateInstanceEnumAsync - Script Execution Returned :4294967295, Error Message:Ausnahme beim Aufrufen von "Connect" mit 1 Argument(en):  "Zugriff verweigert (
      Ausnahme von HRESULT: 0x80070005 (E_ACCESSDENIED))"
      Bei C:\WINDOWS\CCM\SystemTemp\cdb236d6-3f9c-4223-bd42-5a84afcbd631.ps1:111 Zeic
      + $Schedule.connect <<<< ($ComputerName) 
          + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
          + FullyQualifiedErrorId : ComMethodTargetInvocation
      Ausnahme beim Aufrufen von "GetFolder" mit 1 Argument(en):  "Dieser Vorgang wir
      d nur untersttzt, wenn eine Verbindung mit dem Server besteht. (Ausnahme von H
      RESULT: 0x800704E3)"
      Bei C:\WINDOWS\CCM\SystemTemp\cdb236d6-3f9c-4223-bd42-5a84afcbd631.ps1:70 Zeich
      +         $FolderRef = $Schedule.getfolder <<<< ("\")
          + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
          + FullyQualifiedErrorId : ComMethodTargetInvocation
      Sie k”nnen keine Methode fr einen Ausdruck mit dem Wert NULL aufrufen.
      Bei C:\WINDOWS\CCM\SystemTemp\cdb236d6-3f9c-4223-bd42-5a84afcbd631.ps1:115 Zeic
      +     if (($Tasks = $Folder.GetTasks <<<< (1))) {
          + CategoryInfo          : InvalidOperation: (GetTasks:String) [], RuntimeE 
          + FullyQualifiedErrorId : InvokeMethodOnNull
    • I could solve it. The variable COMPUTERNAME has to be swapped for the local ip Then it works
      $ComputerName = ""
    • Maybe it's a too old question to answer now. But, I think it's wise to answer it here so that someone having a similar doubt could understand it.
      0x80070005 - is related to insufficient permission to execute a script.
      You may change the permission for execution on that script or may use an admin session for execution.
  • Scheduled task Run as
    1 Posts | Last post April 02, 2019
    • Hi
      Nice powershell script
      It there a way i can se the value under
      "when running the task, use the following user account"
      regards Mogens
  • Kerberos
    1 Posts | Last post March 25, 2019
    • Does kerberos authentication support for getting the task list.
  • Suggested addition
    1 Posts | Last post October 24, 2018
    • Thanks for your awesome script!  In addition to Name, Path, ... ComputerName properties in the final foreach, I would suggest adding "Folder" and "Actions"
      'Folder' = $Folder.Path
      'Actions' = (([xml]$_.xml).Task.Actions.Exec | % { "$($_.Command) $($_.Arguments)" }) -join "`n"
  • SID
    2 Posts | Last post September 11, 2018
    • I've run the script but for most of the servers I'm querying it's returning SID's instead of the Username that the task is scheduled under.
      Anything that could be done to return the names instead of the SID ?
    • You can query AD on the SID:
      $jobs = get-scheduledtask.ps1 -computername <computer> -RootFolder
      foreach ($job in $jobs) {
      $user = get-aduser -identity $job.UserID
      write-host "Task:" $job.Name
      write-host "Run As:" $user.SamAccountName`n
  • to CSV
    2 Posts | Last post February 13, 2018
    • I'll give 5* if export to csv available :) version 1.3.3?
    • You just do the following :
       .\Get-ScheduledTask.ps1 -ComputerName xxxxx | Export-csv C:\xxxx\xxxx.csv -Encoding UTF8 -NoTypeInformation
  • Filter based on enabled status
    1 Posts | Last post August 29, 2017
    • I'm trying to see if i can filter down to just enabled tasks and tried the following based on other answers 
      .\Get-ScheduledTask -Computername Server01 -RootFolder | Where-object ($_.Enabled -match 'True')
      When i hit enter it just goes to the prompt without any error so I'm sure i'm missing something but not sure what. 
      Any suggestions ?  
  • Filter Output with list of userID
    2 Posts | Last post July 19, 2017
    • Hello,
      Thanks very much for the script.  One quick question though - I have a list txt with multiple userID and is there any way to filter the output so that it only displays tasks that are being run by a specific entity? 
      Thanks again
    • Hi @puffydee you can always use the Group-Object Cmdlet
      Like this:  $tasks | Group-by UserID
  • Hi Brasser!
    1 Posts | Last post July 19, 2017
    • I have updated my script on to match the local and remote computers (even providing a text file with computers).
  • Trigger Details
    1 Posts | Last post February 01, 2017
    • First off; Fantastic script. This gives me almost everything I was looking for except one thing.
      I'm trying to get the trigger details so that I can see when a task is actually scheduled to run.
      When using the example:
      .\Get-ScheduledTask.ps1 | Where-Object {$_.Name -eq 'TaskName'} | Select-Object -ExpandProperty Trigger
      I'll get StartBoundary and ScheduleByWeek (or Day) but then I have to pipe down further to get things like the day of the week it runs.
      Is there any way to have Trigger return anything like the actual detail view in Task Scheduler? (ex. At 2:00AM every Sunday of every week...)
      Preferably with the rest of the script data, but I'll take any info at this point.
1 - 10 of 32 Items