Like I mentioned on the other post, you should not get into the habit of using + to join strings.. it’s inefficient, and in the wrong circumstance can cause massive performance problems. The format operator is much better.
It would help a lot to provide the CSV layout, but this is mostly a guess.
$Names = Import-Csv -Path “$PSScriptRoot\Info.csv” | Select-Object customer, info # comma is the default delimiter, it does not need to be specified
Set-Location -Path "$PSScriptRoot\Collection"
foreach($customer in $Names) {
$CustomerPath = '{0}{1}' -f $Customer.customer, $Customer.Info
if (Test-Path -Path .\$CustomerPath) {
$Message = '{0}{1} {2} exists' -f "`t", $Customer.Client, $Customer.Info
Write-Message -Message $Message -ForegroundColor Green
}
else {
$null = mkdir $CustomerPath
$Message = '{0}{1} {2} created' -f "`t", $Customer.Client, $Customer.Info
Write-Host -Message $Message -ForegroundColor Green
}
}