question

PeterPhillips-7859 avatar image
0 Votes"
PeterPhillips-7859 asked Monalv-msft answered

Invoke-Webrequest SSIS and Not logged-in to host

I've got an PS script using invoke-webrequest to obtain data from an API.
The plan is to run the script as an SSIS package and scheduled using SQL agent using a proxy credential (currently using my account).

This is all working under one scenario - I must be logged onto the server via RDP. Under that condition, it all works fine.
However, when I log off from the server and run the agent job - everything appears fine, but the invoke-webrequest doesn't retrieve any data. (I have tried outputting the command using out-file, and i get back a blank file)

I think it's specifically to how the host server handles the invoke-webrequest when the account used isn't interactive - so...has anyone else encountered this and figured how to get it to work while the account isn't logged on?

sql-server-generalwindows-server-powershellsql-server-integration-services
· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Solved - When trying the script directly from SQL (bypassing SSIS) it gave me useful info. So if anyone else encounters this question, try throwing the script directly into a SQL agent job and see what error it returns - it proved useful in this case.

Result - It wasn't able to use IE, so I had to use the -UseBasicParsing switch.

0 Votes 0 ·

Hi @PeterPhillips-7859 ,

Please paste your solution in the answer.

And then please accept your answer, which can be beneficial to other community members reading this thread.

Best regards,
Mona


If the answer is helpful, please click "Accept Answer" and upvote it.

Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


0 Votes 0 ·

1 Answer

Monalv-msft avatar image
0 Votes"
Monalv-msft answered

Hi @PeterPhillips-7859 ,

May I know if you can paste your solution in the answer and accept your own answer?

Best regards,
Mona

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.