All Versions
To make sure output text is not excessively long, you can use logic like this to shorten text that is longer than a given maximum length:
if ($text.Length -gt $MaxLength) { $text.Substring(0,$MaxLength) + '...' } else { $text }
All Versions
To make sure output text is not excessively long, you can use logic like this to shorten text that is longer than a given maximum length:
if ($text.Length -gt $MaxLength) { $text.Substring(0,$MaxLength) + '...' } else { $text }