Need to create Multiple folders by importing CSV file using powershell.

Need to create Multiple folders by importing CSV file  using powershell.  Below script is giving error in last line of script can any one help whats working in this script , please assist
____________________________________________________________________

$rows=Import-Csv 'C:\Users\Narasimha.s\Desktop\foldertest\project.csv'
foreach ($row in $rows) {
  $folderName = $row.DisplayName
  md -Path C:\$folderName
}
LVL 3
SAM ITAD windows Admin Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Rajul RajInformation Security OfficerCommented:
Use this Script

Set-Location "c:\data\groups" 
 
$Folders = Import-Csv c:\scripts\GroupdOnTRG.csv 
 
ForEach ($Folder in $Folders) { 
 
New-Item $Folder.Name -type directory 
} 

Open in new window

SAM ITAD windows Admin  Author Commented:
I have initiated given error getting error. error message screen shot attached
errorfolder.jpg
Bill PrewIT / Software Engineering ConsultantCommented:
Try:

Set-Location "c:\data\groups" 
 
$Folders = Import-Csv c:\scripts\GroupdOnTRG.csv 
 
ForEach ($Folder in $Folders) { 
 
New-Item -path $Folder -type directory 
} 

Open in new window

~bp
Active Protection takes the fight to cryptojacking

While there were several headline-grabbing ransomware attacks during in 2017, another big threat started appearing at the same time that didn’t get the same coverage – illicit cryptomining.

SAM ITAD windows Admin  Author Commented:
Again getting same error. attached
Bill PrewIT / Software Engineering ConsultantCommented:
Unless you don't have the full path in the CSV, just the name of the new folder, in a column headed DisplayName, which I think would then be:

Set-Location "c:\data\groups" 
 
$Folders = Import-Csv c:\scripts\GroupdOnTRG.csv 
 
ForEach ($Folder in $Folders) { 
 
New-Item -name $Folder.DisplayName -type directory 
} 

Open in new window

~bp
Bill PrewIT / Software Engineering ConsultantCommented:
Can you also show here what the CSV looks like.

~bp
SAM ITAD windows Admin  Author Commented:
getting different error now . attached

CSV format also attached
csvformat.jpg
error1.jpg
Bill PrewIT / Software Engineering ConsultantCommented:
Please attach the actual CSV file, not a picture of it opened as a spreadsheet, need to see the text file.

~bp
SAM ITAD windows Admin  Author Commented:
CSV attached
project.csv
Bill PrewIT / Software Engineering ConsultantCommented:
Add a header line to the CSV, like this:

Name
a
b
c

Open in new window

And then use this script:
Set-Location "c:\data\groups" 
$Folders = Import-Csv c:\scripts\GroupdOnTRG.csv 
ForEach ($Folder in $Folders) { 
  New-Item -name $Folder.Name -type directory 
} 

Open in new window

~bp

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
SAM ITAD windows Admin  Author Commented:
Perfect......

I have one query on this ......

Post creating the folders in the path security group permission has to be apply to created folders

Security Group Name: shr-projectsmodify This Group is part of Active directory. This group permission has to apply on created folders
Bill PrewIT / Software Engineering ConsultantCommented:
Sounds like a new question, and be sure to include the "Active Directory" topic when you create it.

~bp
SAM ITAD windows Admin  Author Commented:
quick  response and resolution
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Powershell

From novice to tech pro — start learning today.