I currently have a two step SQL job that's intention is to do the following;
1) Check file exists. (issue lies here)
2) Run SSIS package to import a csv file to a database.
$File = "\\File\File2\Text.csv"
if(!(Test-Path -Path $File))
{
Write-Error "File does not exist"
}
I get the error below, despite the job compleating succsefully.
"The job script encountered the following errors. These errors did not stop the script: A job step received an error at line 0 in a PowerShell script. The corresponding line is ''. Correct the script and reschedule the job. The error information returned by PowerShell is: 'File does not exist '. Process Exit Code 0. The step succeeded."
The full intention is for then job to fail intentionally, then to quit reporting success.
Popular search methods have returned mutiple variants of the code provided, yet none seem to interact with SQL jobs as I expect. Any ideas?
Thanks in advance!