Hi guys,
I have a very simple script for importing users from a CSV file
here is the code:
#please enter the path of the file with the users - if you made an Excel file, please convert it to CSV # by going to the file and do a "save as" and then pick "csv" #the "$filepath" is the place where you change the path of the csv file #get the file path: $filepath = import-csv "C:\Users\levl\OneDrive\Users Making script\Users-list.csv" #importing the file to the variable and gather the information $users= $filepath #Loop through each row and gather information ForEach ($user in $users) { #Get the users info $firstname = $user }
The script is not completed because i couldn’t make intellisense to complete the script,
after importing the csv file, when i try to write the “$user.” it’s not showing me the headers from the CSV file
here are the headers in the csv file:
First Name,Last Name,SamAccountName,Job Title,Department,Description,Path,ScriptPath
PS: when i run $users i get the list of the users
ok, i’ve figure this out:
So in my case from some strange reason i had to run all the script even though it wasn’t completed, so that PowerShell will import the right properties, only after that i’ve started to see the right Properties according the csv file
so if you encounter with this strange issue when you don’t see the right properties when you try to get all the info from the CSV file, try to write the first few lines in the ForEach loop and then it will start to show you the right properties.
that’s why i like my profession, each day i learn something new