Reputation: 171
First, here's an example of what the text file contains.
bob,supervisor
mary,technician
shane,user
As you may see, on the left is how the user account name would be and on the right is the name of their group they have to be assigned to. These groups are already created. Also, the password isn't written in the text file, but it would be the same for everyone (example: 123). In this example, I only gave an example with 3 users in the file, but the file could also have 100 users to create and assign in it.
I have tried a lot of different ways to make this work, but I just can't figure it out, so if someone could help me, that would be insanely useful.
Upvotes: 1
Views: 1274
Reputation: 863
If you need those to be local users, and assuming your data was in C:\Data.csv, [Untested]
for /f "tokens=1,2 delims=," %%a in ('type "C:\Data.csv"') do (net user %%a 123 /ADD & net localgroup %%b %%a /ADD)
Upvotes: 2