Last week I was working on a PS script to upload files to an FTP and this script supposes to runs through a windows service. It runs perfectly well when it runs manually with the PowerShell ISE.
However, when I scheduled it to run it through a service, service logs below error in the error log.
Run Script Error: 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.”
While creating the script, I did add CLS to the script to clear the screen, so I can see the execution steps in the output window very clearly. This simple command was causing the error when it runs through the service. Only thing I had to do was simply remove the CLS and restart the service.
Please provide your feedback with a comment.
Thank you and Regards,
We are sorry that this post was not useful for you!
Let us improve this post!
Tell us how we can improve this post?