I have several SQL jobs that currently perform nightly (or weekly) restores of a production database on other servers. Since we have now migrated to the Veeam Backup and Replication solution, I am trying to accomplish these same tasks within the Veeam environment. (BTW, we are on Veeam version 11.) I set up the Veeam PowerShell environment as described here https://helpcenter.veeam.com/docs/backup/powershell/getting_started.html?ver=110#remote and wrote a script to perform a database restore (see attached).
I ran the script interactively within a PowerShell session and it completed successfully. I ran it again as a Windows Scheduled Task and it worked. However, I can’t get it to run as a SQL Server Agent job. Here’s the error message that I’m receiving:
The term 'Start-VESQLRestoreSession' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
Since the original SQL job contains steps subsequent to the restore (granting user permissions, etc.), I can’t use the option to run is as a Scheduled Task. The requirements are that it runs as a SQL job. I’m sure that the solution is very simple. I just can’t seem to see it. Can anyone help me you here?