Hi, I am having some issues with a batch script I am writing using dsadd and tokens imported from a csv file. I have gotten the script to work, but what I'm trying
to do is be able to import more information from the CSV for the accounts that need to be built. What is causing me the issue is when I try to add the full DN, minus the CN as a field in my CSV.
The error I am getting is:
dsadd failed:'Services -fn Bugs -ln Bunny -display Bunny,' is an unknown parameter.
The script looks like this:
for /f "tokens=1-6 delims=, " %%A in (userlist.csv) do (dsadd user "CN=%%B %%C,%%F" -fn %%B -ln %%C -display "%%C, %%B" -desc "%%E" -office "Office 5C" -loscr "login.bat" -hmdir "\\homeserver1\%%A" -hmdrv H: -title "%%D" -dept "%%E" -company "Big Company" -upn %%A@company.net[1] -samid "%%A" -pwd Welcome1 -mustchpwd yes -disabled no)
I have bolded the part of the script that I modified, before I added this token the script worked just fine.
In my CSV I have the samaccount name/upn in column A, First Name in column B, Last Name in Column C, Title in column D, description and department in column E, and I added the rest of the DN into column F. Column's A-E are pretty standard so there should be no issues there, and this is what the info in column F looks like:
OU=Department,OU=Location,OU=Users,DC=mycompany,DC=net
I have also tried to adding the common name into column F and running it with the first name last name common name on the DN and get the same error.
I will be glad to answer any questions anyone might have that might help with a solution to my issue.
The error I am getting is:
dsadd failed:'Services -fn Bugs -ln Bunny -display Bunny,' is an unknown parameter.
The script looks like this:
for /f "tokens=1-6 delims=, " %%A in (userlist.csv) do (dsadd user "CN=%%B %%C,%%F" -fn %%B -ln %%C -display "%%C, %%B" -desc "%%E" -office "Office 5C" -loscr "login.bat" -hmdir "\\homeserver1\%%A" -hmdrv H: -title "%%D" -dept "%%E" -company "Big Company" -upn %%A@company.net[1] -samid "%%A" -pwd Welcome1 -mustchpwd yes -disabled no)
I have bolded the part of the script that I modified, before I added this token the script worked just fine.
In my CSV I have the samaccount name/upn in column A, First Name in column B, Last Name in Column C, Title in column D, description and department in column E, and I added the rest of the DN into column F. Column's A-E are pretty standard so there should be no issues there, and this is what the info in column F looks like:
OU=Department,OU=Location,OU=Users,DC=mycompany,DC=net
I have also tried to adding the common name into column F and running it with the first name last name common name on the DN and get the same error.
I will be glad to answer any questions anyone might have that might help with a solution to my issue.