In short, I have a PS script that works via the ISE but not via a SQL Server Agent Job, but it used to work for both!
I will provide more details. The script is powershell 2.0 that is scheduled to be invoked via SQL Server Agent. It invokes other PS scripts. It has worked for a long time. This script is a SQL Server Agent Step of several. There's only one recent change on the server. On the host server, the ISE was not installed. So I had to install the PS ISE and issue the following commands:
This installed the PS ISE successfully. Other than that one change, I did have a problem, which is why I had to install the ISE.
I have a PS script that goes out to SQL Server Logs and gets yesterday's entries and then emails the results to admins. That script was having problems due to the size of a log being gigantic on a particular server. After recycling the log the script stopped "hanging" and would process via the ISE, but it won't work via the SQL Server Agent Job.
So it works in the ISE but not via SQL Server Agent. How can I generate an error so I know what to fix?
Does anyone have an idea as to why this would occur?