J'ai déjà trouver un script qui me liste les utilisateurs ayant des droits sur un fichier :
Code :
- On Error Resume Next
- Dim strComputer 'Nom de l'ordinateur
- Dim ColItems 'Objet
- Dim wmiSecurityDescriptor
- Dim RetVal 'Valeur de retour
- Dim DACL
- Dim wmiAce
- strComputer = "."
- 'Set objWMIService = GetObject( _
- ' "winmgmts:\\" & strComputer & "\root\cimv2" )
- 'Set colItems = objWMIService.ExecQuery("Select * from Win32_LogicalFileSecuritySetting",,48)
- Set ColItems = GetObject ( _
- "winmgmts:Win32_LogicalFileSecuritySetting." & _
- "path='D:\\administration\\wsh\\nouveau.txt'" )
- Wscript.Echo ColItems.Caption & ":" & vbCrlf
- RetVal = ColItems.GetSecurityDescriptor(wmiSecurityDescriptor)
- If Err <> 0 Then
- Wscript.Echo "GetSecurityDescriptor failed" &_
- vbCrlf & Err.Number & vbCrlf & ErrDescription
- Wscript.Quit
- Else
- Wscript.Echo "GetSecurityDescriptor suceeded"
- End If
- DACL = wmiSecurityDescriptor.DACL
- Wscript.Echo "Control Flags: " & wmiSecurityDescriptor.ControlFlags
- Set wmiAce = CreateObject("Scripting.Dictionary" )
- For Each wmiAce In DACL
- Set Trustee = wmiAce.Trustee
- Wscript.Echo "Trustee Name: " & Trustee.Name
- Wscript.echo "Access Mask: " & Trustee.AccessMask
- wmiAce.AccessMask = 37892 '131072
- Wscript.Echo "Access Mask: " & Trustee.AccessMask
- Next
- RetVal = wmiFileSecSetting.SetSecurityDescriptor(wmiSecurityDescriptor)
- Wscript.Echo "ReturnValue is: " & RetVal
|
---------------------
J'aimerais pouvoir modifier ces droits...
---------------
KARON