VSTS
Agent Phase
PowerShell task, inline script
I've also reported this issue at https://developercommunity.visualstudio.com/content/problem/202832/powershell-task-inline-script-max-length-is-too-sh.html
The PowerShell task allows you to specify an inline script, but the max length is 500 characters, which is much too short to write a script of any substance, including proper error checking and handling, etc.
Trying to type in more than 500 characters simply does not allow new characters to be typed, and trying to copy-paste in more than 500 characters results in this error:

The issue occurs when using both Firefox and Chrome.
In code it looks like the max character limit is __supposed__ to be set to 5000, but it's not being obeyed. Even 5000 feels like too low of a limit though.
Could we please:
Thanks!
The 2.x version of the task is 5000. You are using the 1.x version. We also have other limitations to consider, like environment variables which are used to pass the inputs to the task handler, which runs in a separate process. Individual env vars on Windows can't be greater than 32k. There are also limitations, like avoiding the job message size from getting too large. When a build is queued, the job message is sent down to the agent. Workaround beyond 5000 is to check-in a script.
Thanks @ericsciple, I had only checked the version on our TFS 2017 instance (where the 2.x preview doesn't show up yet); looking in my VSTS account though I do see v2 and switching to it does indeed support many more characters. Thanks for the quick reply and explanation of the 5000 character cap.
If you really want to do it, you can hit F12 in the browser and change the number. The validation is in the UI ;)
Thanks for the tip. And I understand it's a "Use at your own risk" type of workaround :) Thanks!
Hi,
At which version number of TFS on-premise server is the version 2 of the agent implemented?
I have TFS Version 15.117.27414.0 which is somewhere above the TFS 2017 Update 3.
When I use a powershell task, my agent displays the text limitation to 500 characters.
I'm guessing I'm using an older version of the Agent. How can I fix this?
Thanks,
Hey @kimballjohnson I believe you need to be using TFS 2018 on-prem for v2 of the PowerShell task to be available, and even then it will show up as "v2 (Preview)", but it works and is stable.
Most helpful comment
If you really want to do it, you can hit F12 in the browser and change the number. The validation is in the UI ;)