Try this (without using the old ADSI clutter):
Get-ADObject -Filter 'servicePrincipalName -like "*"' -properties *|
ForEach-Object{
Write-Host "Object Name = " $_.name -backgroundcolor "yellow" -foregroundcolor "black"
Write-Host "DN = " $_.distinguishedName
Write-Host "Object Cat. = " $_.objectCategory
Write-Host "servicePrincipalNames"
$i = 0
ForEach ( $SPN in $_.servicePrincipalName ) {
Write-Host "SPN(" (++$i) ") = " $SPN
}
Write-Host ""
}
To get all that into a CSV:
Get-ADObject -Filter 'servicePrincipalName -like "*"' -properties *|
ForEach-Object{
$_ | Select-Object @{n='Object Name';e={$_.name}},
@{n="DN";e={$_.distinguishedName}},
objectCategory,
@{n="servicePrincipalNames";e={$_.servicePrincipalName -join ";"}}
} | Export-Csv c:\junk\SPNs.csv -NoTypeInformation
Note that because the number of SPNs may be different for each object it wouldn't do to place each SPN in a separate column. In this example I've placed them all into one column and separated each with a semi-colon.