Pete
asked on
Powershell - check csv format
Hello I want to import a users.csv to create new AD users but I want to check its in the correct format first, how can I do this in powershell? Checking correct column headings, maybe also checking the entire contents not containing illegal characters like hyphens, apostrophes etc..
Any advice please?
Any advice please?
ASKER
That is not the answer to the question, I know what a properly formatted csv should look like, I want to script in some protection in case it is wrong.
What Niten is suggesting, and I'll second, is that Powershell might not be the best tool for doing this 'validation'. You are going to have to read each line from the CSV file, and then perform custom checks on it, based on your own needs, like not allowing certain characters, checking length, if each element is supplied, etc.
It might be easier and more efficient to perform these checks before the file is created.
It might be easier and more efficient to perform these checks before the file is created.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
MassUserCreationScriptSource.xls