Hello ,
I had requirement to create multiple groups in domain. I thought it's pretty straight forward so just used my old Script to do the job for me.
1) My script input file named: groups.txt ( Where you see the group name has space in it )
2) My Old Scripts contains following "DSADD" code using "FOR" loop method

"for /f %%i in (groups.txt) do dsadd group cn="%%i",OU=test,DC=test,DC=pr -scope l"
3) When I executed the script I got the following error popped out in the command prompt window.
If you notice that the error was due to the space in the group name. The for loop script by default took the space as delimiter
So, I have to manually specify the delimiter by ""comma"" instead of the default ""space"" in the script
New Script with delimiter by comma:
Now with the new script, I am able to create the group name with space in it.
Success message of group created: -
Hope, this might help you as well...
I had requirement to create multiple groups in domain. I thought it's pretty straight forward so just used my old Script to do the job for me.
1) My script input file named: groups.txt ( Where you see the group name has space in it )
2) My Old Scripts contains following "DSADD" code using "FOR" loop method

"for /f %%i in (groups.txt) do dsadd group cn="%%i",OU=test,DC=test,DC=pr -scope l"
3) When I executed the script I got the following error popped out in the command prompt window.
If you notice that the error was due to the space in the group name. The for loop script by default took the space as delimiter
So, I have to manually specify the delimiter by ""comma"" instead of the default ""space"" in the script
New Script with delimiter by comma:
Now with the new script, I am able to create the group name with space in it.
Success message of group created: -
Hope, this might help you as well...
No comments:
Post a Comment