Folder security tab properties info using vbscript

Guys,
I have written a code in vbscript which gather information like
when it created,who had access last time name of folder etc...
along with that i want to retrive information related to access
For example who have access to this folder (that you can find in security tab of folder properties).

I want to retrive information related to user who is having access to folder.
any one know how to do that using vbscript.

Regards,

picasothakkarAsked:
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:
You can download xcacls.exe from Microsoft and call that from your script:

http://www.microsoft.com/downloads/details.aspx?FamilyID=7a3e2241-d7d0-42b6-b86e-6eda88726c01&displaylang=en
0
vinnyd79Commented:
Here is a basic example of how you could call it from vbscript:



Dim MyFolder
MyFolder = Chr(34) & "C:\Program Files" & Chr(34)

MsgBox GetAcl(MyFolder)

Function GetAcl(sFolder)
Dim wShell,fso,fil
Set wShell = CreateObject("Wscript.Shell")
wShell.Run "%comspec% /c xcacls.exe " & sFolder & " > C:\TmpPerms.tmp",0,True
Set fso = CreateObject("Scripting.FileSystemObject")
Set fil = fso.OpenTextFile("C:\TmpPerms.tmp")
GetAcl = fil.ReadAll
fil.Close
fso.DeleteFile "C:\TmpPerms.tmp"
Set fil = Nothing
Set fso = Nothing
Set wShell = Nothing
End Function



This page describes the ACL flags. Look at the section on viewing permissions:
http://support.microsoft.com/?kbid=318754
0
picasothakkarAuthor Commented:
I have try.. this

Dim MyFolder
MyFolder = Chr(34) & "C:\WINNT" & Chr(34)

MsgBox GetAcl(MyFolder)

Function GetAcl(sFolder)
Dim wShell,fso,fil
Set wShell = CreateObject("Wscript.Shell")
wShell.Run "%comspec% /c xcacls.exe " & sFolder & " > C:\TmpPerms.tmp",0,True
Set fso = CreateObject("Scripting.FileSystemObject")
Set fil = fso.OpenTextFile("C:\TmpPerms.tmp")
GetAcl = fil.ReadAll
fil.Close
fso.DeleteFile "C:\TmpPerms.tmp"
Set fil = Nothing
Set fso = Nothing
Set wShell = Nothing
End Function

But i recieve this error...
..........Namesofscript.vbs(12,1) Microsoft VBSCRIPT runtime error:Input Past end of file.
Any idea....
i am working on Window 2000 Advanced server.
Regards,
0
vinnyd79Commented:
It sounds like nothing was added to the tmp file. When you install the xcacls.exe utility it gets extracted to a directory in "C:\Program Files\Resource Kit". Try copying the xcacls.exe file to the windows system32 directory then try the above script again.
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
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.