I'm comparing two lengthy text files together by running the script below and writing results into text file. Instead of expected standard compare-object output I get a part of it and everything else gets trimmed (due to maximum characters limit or format template or something). Any ideas how to write the raw output into the file or to increase the limit of characters in a line to get the correct results? The files I compare can not be shortened or reformatted in any way, maybe I could use something else instead of compare-object function?
Thank you!
Script:
function compareConfigs {
Try{
$compareOne = Get-Content $azConfig
$comparetwo = Get-Content $dummyConfig
}
Catch{
Write-Host "Path is invalid or the file does not exist. "
}
Write-Host "Beginning comparison"
$Compare = Compare-Object $compareOne $compareTwo
$compare | foreach {
if ($_.sideindicator -eq '<=')
{$_.sideindicator = $azConfig}
if ($_.sideindicator -eq '=>')
{$_.sideindicator = $dummyConfig}
}
$Compare |
select @{l='Value';e={$_.InputObject}},@{l='File';e={$_.SideIndicator}} |
Out-File $compareResult
Write-Host "Complete!"
}
compareConfigs
Output:
InputObject
-----------
<add fileName="E:\Logs\LeadManagement\LeadService.log" rollSizeKB="4096" timeStampPattern="yyyy-MM-dd" rollFileExistsBehavior="Increment" rollInterval="Day" formatter="Text...
<add template="Timestamp: {timestamp}
Message: {message}
Category: {category}
Priority: {priority}
EventId: {eventid}
Severity: {severity}
Title:{ti...
<add fileName="E:\Logs\LeadManagement\LeadService.log" rollSizeKB="4096" timeStampPattern="yyyy-MM-dd" rollFileExistsBehavior="Increment" rollInterval="Day" formatter="Text...
<add template="Timestamp: {timestamp}
Message: {message}
Category: {category}
Priority: {priority}
EventIwefwefd: {eventid}
Severity: {severity}
Tit...