Hi All,
im fighting with a script that automates backup and restore of a DB (from remote SQL to local SQL)
the script should run from within the SQL server as an Agent Job.
what i have done so far:
- Created a dedicated domain account for the SQL Agent.
- configured the agent service to run with the mentioned account
- granted him local admin membership, SQL admin membership and login as a service permission
- created a Job with a single step of type: CmdExec that runs the following command:
Batchfile
c:\windows\system32\WindowsPowerShell\v1.0\powershell.exe -ExecutionPolicy ByPass -command ". 'C:\Scripts\Refresh\Refresh_SQL.ps1' -Verb runAs"
the script itself starts fine and performs a backup of a db but it keeps failing on a move-item command that should transfer the bak file from remote sql to the local sql:
Powershell
...