Powershell script from SQL Server Agent giving "'Add-Type' is not recognized" error

Advertisement

DakotaPaul
Joined:
Posts:
2

Powershell script from SQL Server Agent giving "'Add-Type' is not recognized" error

I adapted the WinSCP PowerShell example to upload a file and it works perfectly from powershell.exe. I then created an SQL Server Agent job to run this script but it's failing on the try-catch block with the error: "The term 'Add-Type' 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."

In my agent job step the Type is set to PowerShell and I just pasted the script from the .ps1 file that works from the command line. This is on SQL Server 2008 R8. Has anyone seen this before?

Reply with quote

Advertisement

Advertisement

You can post new topics in this forum