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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

STRONGM - Get Folder ACE Flag to see if it inherits permissions 2

Status
Not open for further replies.

TheTuna

Programmer
Dec 13, 2002
544
US
StrongM, if you're available, I'm in a pinch...

Or if anyone knows a quick solution for this issue:

I need to look at a folder and determine if it inherits permissions from its parent folder.

I've been researching the FSO for a way to access ACE flags and I can't find a solution there.

I've been studying GetACE and GetSecurityInfo (all the info I can find on the web) and all I can manage to find is how to set flags, but nothing that tells how to just get the propery of a folder and report if it inherits permissions or not.

Can anyone help? It would be very, very appreciated since we're in a big hurry on this one.

Thanks!

[fish] No Dolphins were harmed in the posting of this message... Dolphin Friendly Tuna!

Ever feel like you're banging your head against a tree? I did, so I cut down the tree.
 
FSO won't do it.

But I recall it can be done through WMI (I'm afraid I'm nowhere near a VB machine today, so I can't really help with code).

Have a look at the Win32_LogicalFileSecuritySetting WMI class, which allows you to retrieve security descriptors that should provide the info that you need

 
Thanks everyone... I'll try to sort it out with this new info!

[fish] No Dolphins were harmed in the posting of this message... Dolphin Friendly Tuna!

Ever feel like you're banging your head against a tree? I did, so I cut down the tree.
 
Here's an illustrative example I put together in VBA

Code:
[blue]Option Explicit

Const AUTO_INHERIT_DACL = &H400

Public Sub Example()
Dim strComputer As String
Dim objWMIService As Object
Dim SecurityDescriptor As Object
Dim objItem As Object

strComputer = "." ' Local computer
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2") ' Get the WMI Service

For Each objItem In objWMIService.ExecQuery("SELECT * FROM Win32_LogicalFileSecuritySetting WHERE Path='C:\\Program Files'")
    If objItem.GetSecurityDescriptor(SecurityDescriptor) = 0 Then
        With SecurityDescriptor
            Debug.Print "Folder: " & objItem.Path
            Debug.Print "Owner: " & .Owner.Domain & "\" & .Owner.Name
            Debug.Print "Permissions automatically inherited from parent: " & ((.ControlFlags And AUTO_INHERIT_DACL) > 0)
        End With
    End If
Next

End Sub[/blue]
 
Thanks again everyone, and strongm... YOU NAILED IT! Thanks!

[fish] No Dolphins were harmed in the posting of this message... Dolphin Friendly Tuna!

Ever feel like you're banging your head against a tree? I did, so I cut down the tree.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top