Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -883,25 +883,28 @@ private static IEnumerable<FormatViewDefinition> ViewsOf_System_Management_Autom
}
}
}
# anything else, we use ToString()
# Anything else, we convert to string.
# ToString() can throw so we use LanguagePrimitives.TryConvertTo() to hide a convert error
else {
$value = $prop.Value.ToString().Trim()

$isFirstLine = $true
if ($value.Contains($newline)) {
# the 3 is to account for ' : '
$valueIndent = ' ' * ($propLength + 3)
# need to trim any extra whitespace already in the text
foreach ($line in $value.Split($newline)) {
if (!$isFirstLine) {
$null = $output.Append(""${newline}${prefix}${valueIndent}"")
$value = $null
if ([System.Management.Automation.LanguagePrimitives]::TryConvertTo($prop.Value, [string], [ref]$value) -and $value -ne $null)
{
$isFirstLine = $true
if ($value.Contains($newline)) {
# the 3 is to account for ' : '
$valueIndent = ' ' * ($propLength + 3)
# need to trim any extra whitespace already in the text
foreach ($line in $value.Split($newline)) {
if (!$isFirstLine) {
$null = $output.Append(""${newline}${prefix}${valueIndent}"")
}
$null = $output.Append($line.Trim())
$isFirstLine = $false
}
$null = $output.Append($line.Trim())
$isFirstLine = $false
}
}
else {
$null = $output.Append($value)
else {
$null = $output.Append($value)
}
}
}

Expand Down