I haven't run this code, but it's probably a better way to deal with this (certainly better than writing the output of the Format-Table to your file!). This builds a hash-of-hashes, allowing you to name the properties:
# Build the hash
$GPO_allsettingsdisabledHASH.add($var.id,
@{
ID = $var.id
DisplayName = $var.displayname
CreationTime = $var.CreationTime
ModificationTime = $var.ModificationTime
Owner = $var.Owner
}
)
# Export the hash values
$GPO_allsettingsdisabledHASH.GetEnumerator() |
Sort-Object $_.Key |
ForEach-Object{
[PSCustomObject]$_.Value
} |
Export-Csv "$ReportPath\_UnUsedGPOs_$domain.txt" -NoTypeInformation