• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 479
  • Last Modified:

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,

0
picasothakkar
Asked:
picasothakkar
  • 3
1 Solution
 
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

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now