Doug
asked on
PowerShell export to csv. Only quote 1 set in each row
When I'm building a CSV Export it puts quotes around every set of parameters. However, I only want 1 set to have the quotes.
This code results in this exported CSV: "LegacyExchangeDN","CloudE mailAddres s","OnPrem iseEmailAd dress","Ma ilboxGUID" "/o=MyUnit/ou=This Admin Group (BRBIDOMF87SRQLT)/cn=Recip ients/cn=a 0dd27c5djd 864108cfa6 1dj37dj56c 6-MyLastNa me, M","mMyLastName@WhereverIm From.Bob.c om","mMyLa stName@Ano therDomain .com","687 efe5e-4690 -110e-86a5 -69fr4cdec f7e"
What I'd like is just the first column of data to have double quotes and the rest without: "/o=MyUnit/ou=This Admin Group (BRBIDOMF87SRQLT)/cn=Recip ients/cn=a 0dd27c5djd 864108cfa6 1dj37dj56c 6-MyLastNa me, M",mMyLastName@WhereverImF rom.Bob.co m,mMyLastN ame@Anothe rDomain.co m,687efe5e -4690-110e -86a5-69fr 4cdecf7e
Any thoughts?
$UserInfo = New-Object System.Object
foreach($user in $MailBoxList)
{
$UserInfo | Add-Member -Type NoteProperty -Name LegacyExchangeDN -Value $user.LegacyExchangeDN
$UserInfo | Add-Member -Type NoteProperty -Name CloudEmailAddress -Value $CloudEmailAddress
$UserInfo | Add-Member -Type NoteProperty -Name OnPremiseEmailAddress -Value
$user.PrimarySMTPAddress.ToString()
$UserInfo | Add-Member -Type NoteProperty -Name MailboxGUID -Value $user.ExchangeGUID
$Users += $UserInfo
}
$Users | Export-CSV -Delimiter "," -Path ".\cloud.csv" -NoTypeInformation
This code results in this exported CSV: "LegacyExchangeDN","CloudE
What I'd like is just the first column of data to have double quotes and the rest without: "/o=MyUnit/ou=This Admin Group (BRBIDOMF87SRQLT)/cn=Recip
Any thoughts?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.