I am using this script, and in powershell, it pulls everything up fine.
get-adgroup -Filter * -property mail | fl SamAccountName, Mail, DistinguishedName
However, when I add this to the end
get-adgroup -Filter * -property mail | fl SamAccountName, Mail, DistinguishedName | Export-Csv c:\My Folder\ADGroup.csv
The excel sheet comes out with the following results.
#TYPE Microsoft.PowerShell.Commands.Internal.Format.FormatStartData
"ClassId2e4f51ef21dd47e99d3c952918aff9cd","pageHeaderEntry","pageFooterEntry","autosizeInfo","shapeInfo","groupingEntry"
"033ecb2bc07a4d43b5ef94ed5a35d280",,,,"Microsoft.PowerShell.Commands.Internal.Format.ListViewHeaderInfo",
"9e210fe47d09416682b841769c78b8a3",,,,,
These are the expected results
SamAccountName : example
Mail : email
DistinguishedName : Long name
Does anyone know what I am doing wrong?
get-adgroup -Filter * -property mail | fl SamAccountName, Mail, DistinguishedName
However, when I add this to the end
get-adgroup -Filter * -property mail | fl SamAccountName, Mail, DistinguishedName | Export-Csv c:\My Folder\ADGroup.csv
The excel sheet comes out with the following results.
#TYPE Microsoft.PowerShell.Commands.Internal.Format.FormatStartData
"ClassId2e4f51ef21dd47e99d3c952918aff9cd","pageHeaderEntry","pageFooterEntry","autosizeInfo","shapeInfo","groupingEntry"
"033ecb2bc07a4d43b5ef94ed5a35d280",,,,"Microsoft.PowerShell.Commands.Internal.Format.ListViewHeaderInfo",
"9e210fe47d09416682b841769c78b8a3",,,,,
These are the expected results
SamAccountName : example
Mail : email
DistinguishedName : Long name
Does anyone know what I am doing wrong?