Search code examples
powershellwindows-server-2008powershell-2.0powershell-3.0invoke-command

Invoke-Command Powershell "Window Title Cannot be longer than X chacracters"


I am trying to run a script remotely using Powershell, the script still runs, but I receive an error Invoke Command : Window Title cannot be longer than 1023 characters.

Here is my code:

Invoke-Command -ComputerName Test -FilePath "\\Some\File\Path.ps1"

I realize what is occuring when running the line in ISE, it places the comments in the header of the script into the files name. Is there a way to prevent this action? I can use the option ErrorAction SilentlyContinue which suppresses the error, but it also suppresses all other errors which is not ideal.


Solution

  • This web link albeit VBS, does provide clarity and a walk-through for your situation.

    https://blogs.technet.microsoft.com/heyscriptingguy/2005/06/02/how-can-i-display-more-than-1023-characters-in-a-custom-message-box/

    This is a more common situation/issue than you would think.

    HTH,

    Kent