Problem
Executed as user: <sql server agent account>. A job step received an error at line 3 in a PowerShell script. The corresponding line is '$RawUI.CursorPosition = @{X=0;Y=0} '. Correct the script and reschedule the job. The error information returned by PowerShell is: 'Exception setting "CursorPosition": "A command that prompts the user failed because the host program or the command type does not support user interaction. Try a host program that supports user interaction, such as the Windows PowerShell Console or Windows PowerShell ISE, and remove prompt-related commands from command types that do not support user interaction, such as Windows PowerShell workflows." '. Process Exit Code -1. The step failed.
Solution
Write-Output "Current Date: $currdate"
Executed as user: <sql server agent account>. A job step received an error at line 3 in a PowerShell script.The corresponding line is '$RawUI.CursorPosition = @{X=0;Y=0} '.
Correct the script and reschedule the job.
The error information returned by PowerShell is: 'Exception setting "CursorPosition": "A command that prompts the user failed because the host program or the command type does not support user interaction. Try a host program that supports user interaction, such as the Windows PowerShell Console or Windows PowerShell ISE, and remove prompt-related commands from command types that do not support user interaction, such as Windows PowerShell workflows." '. Process Exit Code -1.
The step failed.
Looking at the code, there is no command that seems to be prompting a user and waiting for user interaction.
clear
Executed as user: <sql server agent account>. A job step received an error at line 3 in a PowerShell script. The corresponding line is '$RawUI.CursorPosition = @{X=0;Y=0} '. Correct the script and reschedule the job. The error information returned by PowerShell is: 'Exception setting "CursorPosition": "A command that prompts the user failed because the host program or the command type does not support user interaction. Try a host program that supports user interaction, such as the Windows PowerShell Console or Windows PowerShell ISE, and remove prompt-related commands from command types that do not support user interaction, such as Windows PowerShell workflows." '. Process Exit Code -1. The step failed.
$currdate = Get-Date
Write-Output "Current Date: $currdate"
Thanks! Exactly what I needed.
ReplyDeleteI am glad to know that this post helped you.
ReplyDelete