SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Member
    Join Date
    Jun 2010
    Posts
    1
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Make folder, and change permissions

    Hello All,

    I am a relatively new ASP programmer, and I am working on a rather complex script. The script as a whole, creates a Domain User Account as well as create a home folder for them on a network share. I have gotten the whole user account creation working fine, but I have gotten stuck with the home folder part.

    Here is the code that I am using to create the folder, as well as assign the permissions:
    Code VB:
    Sub HomeDir()
    			%>
    			<br/>
    			Inside of Homedir()<br/>
     
     
    			<%
    	strHomeFolder = strHome & strUser
    	Set objFSO = server.CreateObject("Scripting.FileSystemObject")
    	Set objShell = server.CreateObject("Wscript.Shell")
    	If strHomeFolder <> "" Then
    		If Not objFSO.FolderExists(strHomeFolder) Then
    		On Error Resume Next
    		objFSO.CreateFolder strHomeFolder
    			 If Err.Number <> 0 Then
    			 'On Error GoTo 0
    			 'Wscript.Echo "Cannot create: " & strHomeFolder
    			 End If
    		'On Error GoTo 0
    		End If
     
    		On Error Resume Next
     
    		If objFSO.FolderExists(strHomeFolder) Then
    					%>
    			<br/>
    			folder exists<br/>
    			strHomeFolder = <%=strHomeFolder%><br/>
    			strUser = <%=strUser%><br/>
     
    			<%
    		'Assign user permission to home folder.
    		cmdtxt = "%COMSPEC% /c Echo Y| cacls " & strHomeFolder & " /t /c /g Administrators:F " & "SYSTEM:F engineering2\" & strUser & ":F"
    		intRunError = 25
    		intRunError = objShell.run(cmdtxt, 2, True)
    					%>
    			<br/>
    			intRunError = <%=intRunError%><br/>
     
     
    			<%
    			If intRunError <> 0 Then
    			%>
    			<br/>
    			Calcs is balking.......intRunError = <%=intRunError%><br/>
     
     
    			<%
    			'Wscript.Echo "Error assigning permissions for user " _
    			'& strUser & " to home folder " & strHomeFolder
    			End If
    		End If		
    	End If
    	Set objFSO = Nothing
    	Set objShell = Nothing
    End Sub

    Now the first part of this code executes just fine, creating the folder on a remote server. However when it gets into Calcs, it just doesnt do anything. I separated that section of the code, and it returns an "ACCESS Denied" response.

    I have tried several things, including impersonating a user, and none of it has worked. I gave full domain administrator rights(It is in a testing network) to IUSR_SERVER, as well as IWAM_SERVER, yet neither of that has done anything. I also tried to run the script on the local machine, so that it was not a remote destination (changing the path and such) and it still gives me an access denied error.

    Any thoughts? I appreciate any help. I know I am missing something, but I am just stumped.

    Thank you!

  2. #2
    SitePoint Guru
    Join Date
    Jun 2007
    Posts
    690
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    this seems to be a permissions issue, not really an ASP issue.

    --best resolved from an IIS group.


Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •