PowerShell/docs/list-tasks.md
2024-11-20 11:52:20 +01:00

1.1 KiB

The list-tasks.ps1 Script

list-tasks.ps1

Parameters



[<CommonParameters>]
    This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction, 
    WarningVariable, OutBuffer, PipelineVariable, and OutVariable.

Script Content

<#
.SYNOPSIS
	Lists all scheduled tasks
.DESCRIPTION
	This PowerShell script lists all scheduled tasks.
.EXAMPLE
	PS> ./list-tasks.ps1

	TASKNAME                          TASKPATH                             STATE           
	--------                          --------                             -----
	.NET Framework NGEN v4.0.30319    \Microsoft\Windows\.NET Framework\   Ready      
	...
.LINK
	https://github.com/fleschutz/PowerShell0
.NOTES
	Author: Markus Fleschutz | License: CC0
#>

try {
	Get-ScheduledTask | Format-Table -property @{e='TASKNAME';width=40},@{e='TASKPATH';width=55},@{e='STATE';width=10}
	exit 0 # success
} catch {
	"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
	exit 1
}

(generated by convert-ps2md.ps1 as of 11/20/2024 11:51:57)