This recipe illustrates how to list SQL Server Jobs using PowerShell.
Do a visual check of your SQL Server Jobs in your instance. You should see the following jobs after you run the script in this recipe:
These are the steps to list SQL Server Jobs:
Open PowerShell ISE as administrator.
Import the SQLPS module and create a new SMO Server object:
#import SQL Server module Import-Module SQLPS -DisableNameChecking #replace this with your instance name $instanceName = "localhost" $server = New-Object -TypeName Microsoft.SqlServer.Management.Smo.Server -ArgumentList $instanceName
Add the following script and run:
$jobs=$server.JobServer.Jobs $jobs | Select-Object Name, OwnerLoginName, LastRunDate, LastRunOutcome | Sort-Object -Property Name | Format-Table -AutoSize