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
(28)
37,818 times
Add to favorites
Operating System
8/17/2015
E-mail Twitter del.icio.us Digg Facebook
Sign in to ask a question


  • 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
      
  • Exception when calling "Connect" E_ACCESSDENIED
    2 Posts | Last post November 27, 2017
    • 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
      hen:18
      + $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
      en:41
      +         $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
      hen:35
      +     if (($Tasks = $Folder.GetTasks <<<< (1))) {
          + CategoryInfo          : InvalidOperation: (GetTasks:String) [], RuntimeE 
         xception
          + FullyQualifiedErrorId : InvokeMethodOnNull
       
    • I could solve it. The variable COMPUTERNAME has to be swapped for the local ip 127.0.0.1. Then it works
      
      $ComputerName = "127.0.0.1"
      
  • 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
      
      Source:
      https://technet.microsoft.com/en-us/library/ee176864.aspx?f=255&MSPPError=-2147217396
  • Hi Brasser!
    1 Posts | Last post July 19, 2017
    • I have updated my script on https://gallery.technet.microsoft.com/Get-scheduled-tasks-from-1ba9b7fa 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