I have a csv with columns that contain a user's first name last name. I have firgured out how to import the csv data from each column using:
$firstname = Import-csv .\data.csv | select-object "Employee First Name"
$lastname = Import-csv .\data.csv | select-object "Employee Last Name"
I have also figured out that:
$username=$firstname.substring(0,1)+$lastname
works when using system.string objects. The problem is I need to loop through all of names to create a new column with the username and I get the error
System.Object[]] doesn't contain a method named 'substring'
I thought I could convert to string using $firstname.ToString() but I seem to have botched that. Any help is geatly appreciated as I am still trying to learn powershell.