Quantcast
Channel: The Official Scripting Guys Forum! forum
Viewing all articles
Browse latest Browse all 15028

Creating Folders based on usernames created from a .csv file using PowerShell

$
0
0

Hi,

  To preface, I am very, very new to PowerShell.

I am trying to write a script that will reference a .csv file that has two columns (First Name & Last Name) and three names. I want to create a username for each that is the first letter of their first name and their full last name. I also want to create a object "name" that will just be their first name + last name and create folders for each user that use this "Name" object.

Here is

$UserList = IMPORT-CSV C:\Users\Administrator\Desktop\employees.csv

FOREACH ($Person in $UserList) 
{

$Username=$Person.Firstname+$Person.Lastname 

$Name=$Person.Firstname+” “+$Person.Lastname 


New-Item -Path C:\Users\Administrator\Desktop\ -FORCE -type directory -Name($name)
Write-host 
}
Along with my syntax, Im sure there's a lot of things wrong with this. Any help is appreciated and thanks in advance!!!

Viewing all articles
Browse latest Browse all 15028

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>