Skip to content

Instantly share code, notes, and snippets.

@secdev02
Created January 27, 2026 23:59
Show Gist options
  • Select an option

  • Save secdev02/6ce743124521ed45ac6f0439b4a8347f to your computer and use it in GitHub Desktop.

Select an option

Save secdev02/6ce743124521ed45ac6f0439b4a8347f to your computer and use it in GitHub Desktop.
Task Manager

Get-ScheduledTask | Where-Object {$_.Actions.Execute -like 'cmd.exe'} | Select-Object TaskName, TaskPath, State

Get-ScheduledTask | ForEach-Object {
    $task = $_
    $_.Actions | Where-Object {$_.Execute -like '*cmd.exe*'} | ForEach-Object {
        [PSCustomObject]@{
            TaskName = $task.TaskName
            TaskPath = $task.TaskPath
            State = $task.State
            Execute = $_.Execute
            Arguments = $_.Arguments
        }
    }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment