DSADD

Associate
Joined
31 Jan 2007
Posts
1,860
Hey,
I am trying to use DSADD to create a whole load of users froma text file and create their home directories and things. I do Not know a lot about this stuff so please keep your answers simple.

My script is below:

@Echo off
echo Creating Accounts
echo -----------------
for /f "tokens=1-2" %%A in (People.txt) do (dsadd user "CN=%%A %%B, OU=Customer Service, OU=Departments, DC=Neil, dc=Domain" -fn %%A -ln %%B -display "%%A %%B" -samid %%A.%%B -pwd P@ssw0rd -mustchpwd no -disabled no -hmdrv Z: -hmdir "\\neilserver\users\$username$")
echo -----------------
echo Setting Permissions
echo -----------------
net share Chris.Moyles=C:\users\Chris.Moyles
cacls C:\users\Chris.Moyles /E /G Chris.Moyles:F
echo -----------------
pause

it creates the users fine and when I log onto a client as Chris.Moyles the shared folder is there. I open that drive and inside is the users folder and inside that is the Chris.Moyles folder.

If i try to place anything in either the users or the Chris.Moyles folder I egt an Access Denied Message.

I just need to know how to allow the user to put stuff into the Chris.Moyles folder.

How to make the Chris.Moyles folder appear when I open the drive on the client and not the users folder then the Chris.Moyles folder.

and also on the server if I go to the Chris.Moyles folder and check the sharing permissions it does not have Chris.Moyles listed with full control. It just shows "Everyone" and even if I add Chris.Moyles and give him full contro, there then it still fails to work

Any help guys?

Thanks

Regards,
Neil
 
Also as oddjob said.

Even if you were manually creating the folders, you do not share individual user folders, you share the root user folder and point the UNC path at that.
 
How do you let AD create the users folders?

and also I am still getting access denied error messages when trying to place a folder in the users folder on the client side

This is my latest script:

@Echo off
echo Creating Directories
echo -----------------
md C:\users\Chris.Moyles
echo -----------------
echo Creating Accounts
echo -----------------
for /f "tokens=1-2" %%A in (People.txt) do (dsadd user "CN=%%A %%B, OU=Customer Service, OU=Departments, DC=Neil, dc=Domain" -fn %%A -ln %%B -display "%%A %%B" -samid %%A.%%B -pwd P@ssw0rd -mustchpwd no -disabled no -hmdrv Z: -hmdir "\\neilserver\users\%username%")
echo -----------------
echo Sharing Folders
echo -----------------
net share Chris.Moyles=C:\users\Chris.Moyles /GRANT:Chris.Moyles,FULL
echo -----------------
echo Setting Permissions
echo -----------------
cacls C:\users\Chris.Moyles /E /G Chris.Moyles:F
echo -----------------
pause
 
I ahve just run the following and no home drive folders were created


echo Creating Accounts
echo -----------------
for /f "tokens=1-2" %%A in (People.txt) do (
dsadd user "CN=%%A.%%B, OU=Customer Service, OU=Departments, DC=Neil, dc=Domain" -fn %%A -ln %%B -display "%%A %%B" -samid %%A.%%B -pwd P@ssw0rd -mustchpwd no -disabled no -hmdrv Z: -hmdir "\\neilserver\users\%%A.%%B" -profile \\neilserver\profiles\%%A.%%B
)
echo -----------------
 
No, I just need to do it with the script. I can get the users home drive folders working fine if I ahve the script make them as it creates the users and set the permissions for them and to share them.

I understand I can get it to do them automatically but the above works fine for that part at the moment

My problem now is that when I log onto a user account on the client I can see the home directory as a drive, Z in this case and I go in there and try to create a new text file and I just get an access denied error.

This is the bit I am desperate to fix.

My latest script is:


echo Creating Directories
echo -----------------
for /f "tokens=1-2" %%A in (People.txt) do (
md C:\users\%%A.%%B
)
echo -----------------
echo Creating Accounts
echo -----------------
for /f "tokens=1-2" %%A in (People.txt) do (
dsadd user "CN=%%A.%%B, OU=Customer Service, OU=Departments, DC=Neil, dc=Domain" -fn %%A -ln %%B -display "%%A %%B" -samid %%A.%%B -pwd P@ssw0rd -mustchpwd no -disabled no -hmdrv Z: -hmdir "\\neilserver\users\%%A.%%B" -profile \\neilserver\profiles\%%A.%%B
)
echo -----------------
echo Sharing Folders
echo -----------------
for /f "tokens=1-2" %%A in (People.txt) do (
net share %%A.%%B=C:\users\%%A.%%B /GRANT:%%A.%%B,FULL
)
echo -----------------
echo Setting Permissions
echo -----------------
for /f "tokens=1-2" %%A in (People.txt) do (
cacls C:\users\%%A.%%B /E /G %%A.%%B:F
)
echo -----------------
pause
 
try this...

echo Creating Accounts
echo -----------------
for /f "tokens=1-2" %%A in (People.txt) do (
dsadd user "CN=%%A.%%B, OU=Customer Service, OU=Departments, DC=Neil, dc=Domain" -fn %%A -ln %%B -display "%%A %%B" -samid %%A.%%B -pwd P@ssw0rd -mustchpwd no -disabled no -hmdrv Z: -hmdir \\neilserver\users\$username$ -profile \\neilserver\profiles\%%A.%%B
)
echo -----------------

PS i know the syntax for username is usually %username% (not $username$) but its a MS boo boo with the dsadd command.

the syntax is also listed here in the "remarks"

http://technet.microsoft.com/en-us/library/cc731279.aspx
 
Last edited:
I don't see what difference this is:

I don't see what it is trying to fix?

Is it to fix the access denied error I am trying to resolve?

try this...

echo Creating Accounts
echo -----------------
for /f "tokens=1-2" %%A in (People.txt) do (
dsadd user "CN=%%A.%%B, OU=Customer Service, OU=Departments, DC=Neil, dc=Domain" -fn %%A -ln %%B -display "%%A %%B" -samid %%A.%%B -pwd P@ssw0rd -mustchpwd no -disabled no -hmdrv Z: -hmdir \\neilserver\users\$username$ -profile \\neilserver\profiles\%%A.%%B
)
echo -----------------

PS i know the syntax for username is usually %username% (not $username$) but its a MS boo boo with the dsadd command.

the syntax is also listed here in the "remarks"

http://technet.microsoft.com/en-us/library/cc731279.aspx
 
I ahve just run the following and no home drive folders were created

:rolleyes:

the $username$ part of the command will take the SAMID which = %%A.%%B & i'm not 100% certain but i'm pretty sure you dont need the UNC path in quotation marks either because it doesn't have a space.
 
Last edited:
No, I just need to do it with the script. I can get the users home drive folders working fine if I ahve the script make them as it creates the users and set the permissions for them and to share them.

I'm not saying you can't eventually use a script but as you said in your OP

I do Not know a lot about this stuff so please keep your answers simple.

I thought you might want to start doing it the most simple way. Make sure it works (because if it doesn't work that way then you'll have loads of issues with it working using a script) and then try using a script.

Have you checked the NTFS AND share permissions on the user drive share?

For a start you seem to be trying to create a share for each user. Is that correct? You should be creating a "root" user share, then creating (non shared) subdirectories within that share.
 
Back
Top Bottom