setting folder permissions & Running dos command

I have this function that executes a dos command, and returns the result :
-------------------------------------------------------
Function runShell(strDosCmd)
      Dim objShell, objScriptExec
      On Error Resume Next
      Set objShell = CreateObject("WScript.Shell")
      Set objScriptExec = objShell.Exec(strDosCmd)
      runShell = objScriptExec.StdOut.ReadAll
      Set objShell = nothing
      Set objScriptExec = nothing
End Function
-------------------------------------------------------

I'm trying to set some permissions on some new profile & home directories (for a new AD user) that I've created.
This call fails (no error - null returned):

runShell("%comspec% /c cacls \\server\profiles$\user1 /E /G Domain\Admin:F")

-- but this one works :

runShell("%comspec% /c cacls c:\temp /E /G Domain\Admin:F")

It seems that any UNC paths I pass, cause the command to return null.   What's up ?

This is the only way I know to set permissions in my new user creation script.  If anyone's got a better way to set permissions, I NEED IT !   thanks ...
LVL 5
GitchoAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

vinnyd79Commented:
If you take the "On Error" line out of the function and call it with a UNC path, what error do you get?
0
David LeeCommented:
This might help too.  http://setacl.sourceforge.net/
0
GitchoAuthor Commented:
vinnyd79:   no error ... command executes with a null response, but doesn't do anything. I know this, because if I append " > output.txt" to the command, it will create the file

blue : that's a last resort ... don't really want to install & configure activex controls ...
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

EDDYKTCommented:
What is this path?

\\server\profiles$\user1

can you access from explorer?


should it be just
\\server\profiles\user1


or if you are admin user, you can

\\server\c$\user1
0
GitchoAuthor Commented:
???  $ = hidden share - but that's kind of irrelevant.  The command i'm passing works when I enter it manually in dos
0
GitchoAuthor Commented:
Blue : haven't messed with loading activeX controls ( http://setacl.sourceforge.net/ ) ...

Do I have to re-configure IIS ? or can I copy the file to a local directory and instatiate it from the page ?  If I can get this to work, i'll go with it.
0
David LeeCommented:
Hi, Gitcho.

I thought you were running this process from a script.  Do I understand instead that you're running it from a web page?  If you're running it from a script, then all you should need to do is register the ocx (i.e. regsvr32 setacl.ocx) and then use it in the script.  The same would generally apply to using it from a web page, but of course your browser would need to be configured to allow the use of activex controls.  I don't believer there'd need to be any changes made to IIS.  
0
GitchoAuthor Commented:
Yes, this is all from a webpage ... would you mind providing sample code to include, instantiate & use ?
0
David LeeCommented:
Gitcho,

Here's the web page code.  This is for an ASP web page.  I cannibalized the code from the sample code that came with the OCX.  It works fine in my testing.  I created two pages, one containing a form where I entered the path to the folder, the account I wanted to grant rights to, and the rights I wanted to grant.  Clicking the Submit button on the first page sends me to the second page where I retrieve the values from the form fields on the first page and execute the code below.  

Hope this helps.

<%
dim objSetACL, intError, strUsername
Set objSetACL = Server.CreateObject("SetACL.SetACLCtrl.1")
intError = objSetACL.SetObject(Request.Form("txtFolder"), 1)
If intError <> 0 Then
    Response.Write("SetObject failed: " & objSetACL.GetResourceString(intError) & "<br>OS error: " & objSetACL.GetLastAPIErrorMessage())
End If
intError = objSetACL.SetAction(1)
If intError <> 0 Then
    Response.Write("SetAction failed: " & objSetACL.GetResourceString(intError) & "<br>OS error: " & objSetACL.GetLastAPIErrorMessage())
End If
intError = objSetACL.AddACE(Request.Form("txtUsername"), False, Request.Form("txtRights"), 0, False, 1, 1)      
If intError <> 0 Then
    Response.Write("AddACE failed: " & objSetACL.GetResourceString(intError) & "<br>OS error: " & objSetACL.GetLastAPIErrorMessage())
End If
intError = objSetACL.Run
If intError <> 0 Then
    Response.Write("Run failed: " & objSetACL.GetResourceString(intError) & "<br>OS error: " & objSetACL.GetLastAPIErrorMessage())
End If
%>
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
David LeeCommented:
Oh, one other point.  To be able to set the permissions I had to turn on authentication for the web site.  Otherwise the page uses the IUSR account and the permissions don't get set.
0
GitchoAuthor Commented:
sorry for the delay on this one, but that's what I was looking for.  Thx.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.