dbatools is a free PowerShell module with over 300 SQL Server administration, best practice and migration commands included.

Please note that documentation and command names may be out of date while we work furiously towards 1.0


Sets the OutPut File for a step of an agent job with the Job Names and steps provided dynamically if required.


To set the job step output file for The Agent job on SERVERNAME to E:\Logs\AgentJobStepOutput.txt

Set-DbaAgentJobOutputFile -sqlserver SERVERNAME -JobName ‘The Agent Job’ -OutPutFile E:\Logs\AgentJobStepOutput.txt


This command was created by Rob Sewell. You can find Rob on Twitter and his blog.


From PowerShell, execute Get-Help Set-DbaAgentJobOutputFile -Detailed for more information on this function.

Source Code

Want to see the source code? View Set-DbaAgentJobOutputFile.ps1 on GitHub

Related commands