View Scheduled Tasks on Remote Computers

At times it is necessary to update passwords on service accounts or make other changes and it is hard to keep track of where that service account has been used.  One of the places that they are often used is in Scheduled Tasks.  This script allows you to query a computer for sche

Get-SchTasks.ps1
 
 
 
 
 
3.8 Star
(5)
3,372 times
Add to favorites
Operating System
12/17/2011
E-mail Twitter del.icio.us Digg Facebook
  • URI not in RegistrationInfo on remote computers
    1 Posts | Last post May 25, 2017
    • Looks like URI is only available when getting tasks from local machine.
      
      I output schtasks to CSV format rather than XML and the information is there:
      
      foreach ($server in @("SERVERNAME1","SERVERNAME2")) {
      write-host "Server: $server"
      foreach ($task in (schtasks /query /V /FO CSV /S $server | ConvertFrom-Csv)) {
      if ($task.'Run As User' -eq "DOMAIN\ACCOUNT" -and $task.'Scheduled Task State' -eq "Enabled") {write-host "TaskName:$($task.taskname)"}}Write-host "`n"}
  • URI not in RegistrationInfo of all tasks?
    1 Posts | Last post October 10, 2013
    • In
      $TaskURI = $_ | Select -ExpandProperty RegistrationInfo | Select -ExpandProperty URI
      ...
       It looks like you're trying to get the path and name of the task, but "URI" doesn't appear in every task.
  • how about if i have a text file (servers.txt) that include all of the servers and also would it be possible to export the result in c:\result.txt ?
    1 Posts | Last post June 04, 2013
    • also how do I run the scripts?
  • I get an error when running get-schtasks?
    2 Posts | Last post December 29, 2011
    • When I execute the code it complains that get-schtasks is not recognized as a cmdlet, function, etc..
      
      Did you have this written as a function somewhere else? 
    • Yes, you must download the script at the top of this page which includes the Get-SchTasks function.