Hi everyone.I have a powershell script that lists all backup status across various servers.Script runs fine via Powershell gui (Normally) Sometimes I see an issue. Think it is regarding Excel and how it outputs its results.I can see that when the spreadsheet is created, it leaves the excel.exe*32 running on my machine.Unless I close that , or go into spreadsheet and exit it, subsequent runs also fail.When not there , runs fine.However when run as SQL agent job it always fails.this is the error.A job step received an error at line 88 in a PowerShell script. The corresponding line is '$Excel.SaveAs("Y:\SQL\Failedjobs.xlsx")'. Correct the script and reschedule the job. The error information returned by PowerShell is: 'Exception calling "SaveAs" with "1" argument(s): "SaveAs method of Workbook class failed"Any tips on how to correct this , or what I am doing wrong and need to check ?many thanks
↧