Hello,
When I output to CSV, I need $DN to read “lastname, firstname” but this keeps getting delimited in the CSV. Based on my code below, how can I prevent the delimit?
Many thanks!
======================================================
$ErrorActionPreference = ‘SilentlyContinue’
$File = “$env:userprofile\desktop\LoadTestVantage.csv”
“DisplayName” | Out-File -FilePath $File -Encoding utf16
1…10 | % {
$Lines = “”
1…10 | % {
$NameDB = import-csv “$env:userprofile\desktop\NameDB.csv”
$PFN = $NameDB.first_name |Get-Random
$PLN = $NameDB.last_name |Get-Random
$DN = $PLN+", "+$PFN
Lines += [string]$DN + [char]10 + [char]13
}
$Lines | out-file -FilePath $File -Encoding UTF8 -Append
}
============================================================