Failed to find file

  • I've been executing a powershell script from SQL Server agent (sql 2008) for a while now using the Operating System (CmdExec) job step with the following expression.

    powershell.exe C:\BackupAnalysis\RecentBackups.ps1

    I'm migrating this to a SQL Server 2005 server,updating the file path and trying to do the same. However, I'm getting a failed to find file error. I've tried inputting the unc path to the file. This works as a windows scheduled task but not through SQL job step.

    Has anyone encountered this?

  • One possibility: the account running the SQL Agent job does not have access to the file path where the PS script resides.

    There are no special teachers of virtue, because virtue is taught by the whole community.
    --Plato

  • Thanks for the reply, I'll take a look, but the user is an admin on the server

  • Another possibility: on the new server did you run Set-ExecutionPolicy under the context of the user trying to run the script?

    There are no special teachers of virtue, because virtue is taught by the whole community.
    --Plato

  • execution policy was set correctly.

    I resolved this issue by fully qualifying the path the powershell.exe

    Thanks for your thoughts though!

  • Ha! Next time say which file it could not find 😉 Happy you got it sorted 🙂

    There are no special teachers of virtue, because virtue is taught by the whole community.
    --Plato

Viewing 6 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic. Login to reply