Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CACLS.exe fail with ASP (NT permissions)

Status
Not open for further replies.
Joined
Mar 26, 2003
Messages
9
Location
GB
Hi,
I'm trying to create a NT user via an ASP script and *everything* works except setting the permissions on the user folder using a DOS command as suggested to use by many others...
The user gets created, the folder gets created, then comes this part - (code far below).
It runs thru this but doesn't actually execute it. No errors come up either.

IF I take the exact lines of code (with the user_samName hardcoded in) and paste it into a command prompt, it works fine.
IF I take the whole script and name it with a .vbs ending and then execute it, IT WORKS. Only when transferring it to ASP doesn't it work.
Some people said I have to echo a 'yes' as shown below, but that didn't help. I've tried it with alternative XCACLS, but that doesn't work either (unless of course you end it with .vbs or paste it into a command prompt!

'~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Sub RunCmd(sCmd)
set oShell = CreateObject("WScript.Shell")
oShell.Run "%COMSPEC% /C" & sCmd,0,True
End Sub

RunCmd "echo y| cacls \\bones\users\" & usr_samName & " /E /G administrators:F"
RunCmd "echo y| cacls \\bones\users\" & usr_samName & " /E /R Everyone"
RunCmd "echo y| cacls \\bones\users\" & usr_samName & " /E /G " & usr_samName & ":C"

' Or this, below.......
' But Even if i try to hardcode the username in
' such as RunCmd "xcacls \\bones\users\testuser /E /R Everyone /y"
' it still doesn't work in ASP, but does in DOS and VBS...

RunCmd "xcacls \\bones\users\" & usr_samName & " /E /G administrators:F /y"
RunCmd "xcacls \\bones\users\" & usr_samName & " /E /R Everyone /y"
RunCmd "xcacls \\bones\users\" & usr_samName & " /E /G " & usr_samName & ":C /y"

'~~~~~~~~~~~~~~~~~~~~~~~~~~~~

(obviously, the usr_samName is a known variable in the beginning of my real script and the user directory has already been created successfully....)


Doing my head in!

TIA
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top