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


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