Powershell – Is start-process supported in a powershell step on SQL Server 2008 R2

powershellsql-server-2008-r2

With the described configuration, I have a SQL Agent Job that includes a Powershell step. That step throws an error when it gets to the line

$app = start-process -passthru $program $program_args

saying –

"The error information returned by PowerShell is: 'The term 'start-process' 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. '. Process Exit Code -1. The step failed."

The lines preceding this seem to work ok. I suspect that the Powershell host that is running the script is crippled regarding that function but I am not able to verify this anywhere.

Best Answer

That's correct start-process isn't available in the sqlps mini-shell. You can determine by running get-command:

 SQLSERVER:\>get-command start-*

You could try running a cmdexec job step calling powershell.exe.