SSIS Package Run via SQL Agent Prooducing Different Results

NoahWenger-2370 6 Reputation points
2022-02-28T17:37:28.81+00:00

Hi community!

I am trying to execute an SSIS package in SSMS via SQL Agent. The package is configured to run a Powershell script. Wen I execute the package manually (in Visual Studio 2019 or in the SSISDB catalog), I get the correct results. When I manually execute the PowerShell script itself, I get the correct results.

I have attempted to use a proxy account to run the SQL Agent Job, but I am still not getting the correct results. Does someone have any knowledge or experience with this? I am on SQL Server 2017 CU20, Windows Server 2019, PowerShell 7.2.1.

I have tried mixing and matching other configurations....please help!

Thank you,
Noah

SQL Server Integration Services
SQL Server Integration Services
A Microsoft platform for building enterprise-level data integration and data transformations solutions.
2,702 questions
Windows for business Windows Server User experience PowerShell
{count} votes

3 answers

Sort by: Most helpful
  1. MotoX80 36,291 Reputation points
    2022-02-28T18:04:24.767+00:00

    Add a transcript to the script to capture it's activity. See if it generates an error somewhere.

    https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.host/start-transcript?view=powershell-5.1

    Start-Transcript -Path C:\windows\temp\Myscript.log  
    Your script code goes here.  
    Stop-Transcript  
    
    0 comments No comments

  2. NoahWenger-2370 6 Reputation points
    2022-02-28T20:47:10.297+00:00

    Thank you MotoX80. There were no errors recorded. While the transcript was recording information, I executed the SSIS package which executes the PowerShell script and there were no messages in the transcript.


  3. NoahWenger-2370 6 Reputation points
    2022-02-28T21:37:32.713+00:00

    Hey MotoX80,

    I did not understand that the Start-Transcript statements go into my PS script...I added the statements to my PS Script and still when I execute the SSIS package via SQL Agent, I am getting the wrong results and no messages between the start and end of the transcript. The below text was copied directly from the transcript output file:

    Transcript started, output file is (I removed the file path for security purposes)


    PowerShell transcript end

    ....


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.