• By default the output in SQL Server Agent goes to the msdb.dbo.sysjobhistory table (that's what you see when you ask to view history from the job).

    To get the output somewhere else, there are a number of possibilities, for example you could do this:

    $server = new-object( 'Microsoft.SqlServer.Management.Smo.Server' ) “(local)”

    foreach ($database in $server.databases)

    {

    $dbName = $database.Name

    Write-Output "Database: $dbName" | Out-File c:\temp\temp.txt -append

    }

    Which will create and then append results to teh file c:\temp\temp.txt with the list of database names.