Thor Logo dbatools

Agent

Set-DbaAgentJobOutputFile

Rob Sewell, sqldbawithabeard.com

Set-DbaAgentJobOutputFile View Source Rob Sewell, sqldbawithabeard.com Windows, Linux, macOS Synopsis Configures the output file path for SQL Server Agent job steps to capture step execution logs. Description Modifies the output file location where SQL Server Agent writes job step execution details, error messages, and command output. This centralizes logging for troubleshooting failed jobs, monitoring step execution, and maintaining audit trails without manually editing each job step through SQL Server Management Studio.

Read more

Set-DbaAgentJobOwner

Michael Fal (@Mike_Fal), mikefal.net

Set-DbaAgentJobOwner View Source Michael Fal (@Mike_Fal), mikefal.net Windows, Linux, macOS Synopsis Updates SQL Server Agent job ownership to ensure jobs are owned by a specific login Description This function standardizes SQL Agent job ownership by updating jobs that don’t match a specified owner login. It’s commonly used for security compliance, post-migration cleanup, and environment standardization where consistent job ownership is required. By default, jobs are reassigned to the ‘sa’ account (or the renamed sysadmin account if ‘sa’ was renamed), but you can specify any valid login.

Read more

Set-DbaAgentJobStep

Sander Stad (@sqlstad), sqlstad.nl

Set-DbaAgentJobStep View Source Sander Stad (@sqlstad), sqlstad.nl Windows, Linux, macOS Synopsis Modifies properties of existing SQL Agent job steps or creates new ones with Force parameter. Description Modifies SQL Agent job step properties including commands, subsystems, retry logic, success/failure actions, and execution context. Updates existing job steps by name or creates new steps when using the -Force parameter, eliminating the need to manually edit job steps through SSMS. Common use cases include changing job step commands during deployments, updating database contexts when moving jobs between environments, modifying retry settings for intermittent failures, and adjusting success/failure flow logic.

Read more

Set-DbaAgentOperator

Tracy Boggiano (@TracyBoggiano), databasesuperhero.com

Set-DbaAgentOperator View Source Tracy Boggiano (@TracyBoggiano), databasesuperhero.com Windows, Linux, macOS Synopsis Modifies existing SQL Agent operator contact details, pager schedules, and failsafe settings. Description Modifies existing SQL Agent operators by updating their contact information, pager notification schedules, and failsafe operator configuration. This lets you change email addresses, pager contacts, net send addresses, and specify when pager notifications should be active without having to manually update operators through SQL Server Management Studio.

Read more

Set-DbaAgentSchedule

Sander Stad (@sqlstad, sqlstad.nl)

Set-DbaAgentSchedule View Source Sander Stad (@sqlstad, sqlstad.nl) Windows, Linux, macOS Synopsis Modifies properties of existing SQL Agent job schedules Description Modifies the timing, frequency, and other properties of existing SQL Agent job schedules without recreating them. You can update schedule frequency (daily, weekly, monthly), change start/end times and dates, enable or disable schedules, and rename them. The function works with schedules already attached to jobs and validates all timing parameters to prevent invalid configurations.

Read more

Set-DbaAgentServer

Claudio Silva (@claudioessilva), claudioessilva.com

Set-DbaAgentServer View Source Claudio Silva (@claudioessilva), claudioessilva.com Windows, Linux, macOS Synopsis Configures SQL Server Agent service properties and operational settings Description Modifies SQL Server Agent configuration settings including logging levels, mail profiles, CPU monitoring thresholds, job history retention, and service restart behaviors. Use this to standardize agent configurations across multiple instances, set up proper alerting and monitoring thresholds, or configure job history retention policies to prevent MSDB bloat. Syntax Set-DbaAgentServer [[-SqlInstance] <DbaInstanceParameter[]>] [[-SqlCredential] <PSCredential>] [[-InputObject] <JobServer[]>] [[-AgentLogLevel] <Object>] [[-AgentMailType] <Object>] [[-AgentShutdownWaitTime] <Int32>] [[-DatabaseMailProfile] <String>] [[-ErrorLogFile] <String>] [[-IdleCpuDuration] <Int32>] [[-IdleCpuPercentage] <Int32>] [[-CpuPolling] <String>] [[-LocalHostAlias] <String>] [[-LoginTimeout] <Int32>] [[-MaximumHistoryRows] <Int32>] [[-MaximumJobHistoryRows] <Int32>] [[-NetSendRecipient] <String>] [[-ReplaceAlertTokens] <String>] [[-SaveInSentFolder] <String>] [[-SqlAgentAutoStart] <String>] [[-SqlAgentMailProfile] <String>] [[-SqlAgentRestart] <String>] [[-SqlServerRestart] <String>] [[-WriteOemErrorLog] <String>] [-EnableException] [-WhatIf] [-Confirm] [<CommonParameters>] Examples Example: 1 PS C:\> Set-DbaAgentServer -SqlInstance sql1 -MaximumHistoryRows 10000 -MaximumJobHistoryRows 100 Changes the job history retention to 10000 rows with an maximum of 100 rows per job.

Read more

Start-DbaAgentJob

Chrissy LeMaire (@cl), netnerds.net

Start-DbaAgentJob View Source Chrissy LeMaire (@cl), netnerds.net Windows, Linux, macOS Synopsis Starts SQL Server Agent jobs and optionally waits for completion Description Starts one or more SQL Server Agent jobs that are currently idle. This function validates jobs are in an idle state before starting them and can optionally wait for job completion before returning results. You can start all jobs, specific jobs by name, or exclude certain jobs from execution.

Read more

Stop-DbaAgentJob

Chrissy LeMaire (@cl), netnerds.net

Stop-DbaAgentJob View Source Chrissy LeMaire (@cl), netnerds.net Windows, Linux, macOS Synopsis Stops running SQL Server Agent jobs by calling their Stop() method. Description Stops currently executing SQL Server Agent jobs and returns the job objects for verification after the stop attempt. Perfect for halting runaway jobs during maintenance windows, stopping jobs that are causing blocking or performance issues, or clearing job queues before scheduled operations. The function automatically skips jobs that are already idle and can optionally wait until jobs have completely finished stopping before returning results.

Read more

Test-DbaAgentJobOwner

Michael Fal (@Mike_Fal), mikefal.net

Test-DbaAgentJobOwner View Source Michael Fal (@Mike_Fal), mikefal.net Windows, Linux, macOS Synopsis Identifies SQL Agent jobs with incorrect ownership for security compliance auditing Description This function audits SQL Agent job ownership by comparing each job’s current owner against a target login, typically ‘sa’ or another sysadmin account. Jobs owned by inappropriate accounts can pose security risks, especially if those accounts are disabled, deleted, or have reduced permissions. By default, it checks against the ‘sa’ account (or renamed sysadmin), but you can specify any valid login for your organization’s security standards.

Read more
← Previous
1 2 3 4 5
Next →
Page 5 of 5