June 17, 2011 at 1:10 pm
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?
June 17, 2011 at 1:58 pm
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
June 20, 2011 at 5:39 am
Thanks for the reply, I'll take a look, but the user is an admin on the server
June 20, 2011 at 5:54 am
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
June 21, 2011 at 6:21 am
execution policy was set correctly.
I resolved this issue by fully qualifying the path the powershell.exe
Thanks for your thoughts though!
June 21, 2011 at 6:24 am
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