1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
|
strComputer = "."
Set objWMI = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
set objFs = GetObject("WinNT://" & strComputer & "/LanmanServer,FileService")
For Each objShare In objFs
If InStr(objShare.path, "D:\") Then
strDir = objShare.path
WScript.Echo
WScript.Echo "Chemin partage : " & strDir
WScript.Echo "Nom partage : " & objShare.name
strDir = Replace(strDir,"\","\\")
Set colItems = objWMI.ExecQuery("Select * from win32_logicalFileSecuritySetting WHERE Path='" & strDir & "'",,48)
For each objItem in colItems
If objItem.GetSecurityDescriptor(wmiSecurityDescriptor) Then
WScript.Echo "GetSecurityDescriptor failed"
DisplayFileSecurity = False
WScript.Quit
End If
For each wmiAce in wmiSecurityDescriptor.DACL
strACE = wmiAce.Trustee.Domain & "\" & wmiAce.Trustee.Name
WScript.echo " - " & strACE
Next
Next
End If
Next |
Partager