Hi jojo

The script is fairly straight forward. Assuming you want the folder to be called the username, the following should work (untested):

 Code:
$sFolder = @USERID
$sServerDir = "\\PDC\Share\"

If Not Exist($sFolder + $sServerDir) ;if the user does not have a directory on the server
	$ = MD($sFolder + $sServerDir)	;make the directory
        "Returned (" + @SERROR + ")" ?  ;Display the result of creating the folder
Else
	;User has a folder on the server. Do nothing
EndIf


Permissions may be an issue. There are a few ways around it, firstly you can set the permissions on the top level of the folder to allow users to create folders. For security purposes, it is best to set these permissions to only apply to 'This Folder Only' (in advanced NTFS permissions). What that does is it only allows users to create folders in the root of that folder.

Assuming that the intention is to give users a private drive (AKA Home drive), using the Home drive path in Active Directory is probably the easiest way to go, it for the most part handles the permission problem itself.

The problem with running it as an administrator is that chances are, permissions on the root folder propagating will prevent the user from writing or maybe even reading from the directory if it is created by an administrative account.


Edited by lukeod (2009-09-08 12:39 AM)