Verwijderd schreef op woensdag 28 december 2005 @ 10:45:
Hoi,
Google, xcacl en cacl ed willen allemaal niet werken. Mijn vraag:
2003 server:
Ik heb tig folders en shares en tig security groups. Ik wil graag een lijst hebben van welke FOLDERS de desbetreffende group lid zijn en welke rechten.. Is hier een handig commando of programma voor?
Bedankt!
Dennie
Zelf geschreven voor me werk.. Wees er voorzichtig mee
'----------------------------------------------------------------------
' GetGroups.vbs, v1.5
' VBScript getting groups of an AD-user (including nested groups)
' Samenstelling: Shizzles ^ Squ1rr3l, 11-2004
'----------------------------------------------------------------------
Option explicit
Dim strSearchAccount, strBaseOU, strADsPath, StrCn, strDisplayName
Dim objConnection, objCommand, objRecordSet, objUser, objExplorer, objDocument
Dim colGroups, objGroup, wshShell
strBaseOU="DC=europe,DC=intranet"
Call Init
strSearchAccount = InputBox("Geef gebruikersnaam op:", "Zoek user")
CheckForUser(strSearchAccount)
'-------------------------
' subs
'-------------------------
Sub Init
Set objExplorer = CreateObject("InternetExplorer.Application")
objExplorer.Navigate "about:blank"
objExplorer.ToolBar = 0
objExplorer.StatusBar = 0
objExplorer.Width = 800
objExplorer.Height = 700
objExplorer.Left = 140
objExplorer.Top = 0
objExplorer.Visible = 1
Do While (objExplorer.Busy)
Loop
Set objDocument = objExplorer.Document
objDocument.Open
objDocument.Writeln "<html><head><title>Zoekresultaten</title></head><body bgcolor='lightgrey'><font face='arial,verdana'>"
End Sub 'Init
Sub CheckForUser(strSearchAccount)
Set objConnection = CreateObject("ADODB.Connection")
objConnection.Open "Provider=ADsDSOObject;"
Set objCommand = CreateObject("ADODB.Command")
objCommand.ActiveConnection = objConnection
objCommand.CommandText = "<LDAP://" & strBaseOU & ">;(&(objectCategory=person)(objectClass=user)(samAccountName=" & strSearchAccount & "));displayName,cn,distinguishedName,ADsPath;subtree"
Set objRecordSet = objCommand.Execute
If objRecordset.RecordCount = 0 Then
WScript.Echo "sAMAccountName: " & strSearchAccount & " bestaat niet!"
Else
'WScript.Echo strSearchAccount & " exists, Rec count: " & objRecordset.Recordcount
While Not objRecordset.EOF
objRecordSet.MoveFirst
strADsPath=objRecordset.Fields("ADsPath")
strCn=ObjRecordset.Fields("cn")
strDisplayName=ObjRecordset.Fields("displayName")
objDocument.Writeln "<table border='0' width='100%'><tr valign='top'>"
objDocument.Writeln "<td><H3>Groepen voor gebruiker: " & strSearchAccount & "</H3></td><td align='right'><FORM><INPUT TYPE='button' VALUE='Print' onClick='window.print()'></FORM></td>"
objDocument.Writeln "</tr></table>"
objDocument.Writeln "<H2>" & strDisplayName & " (" & strCn & ")</H2><font size='-1'>"
Set objUser = GetObject(strADsPath)
If Err.Number <> 0 Then
Wscript.Echo "User not found !" & vbCrLf & cn
Wscript.Quit(1)
End If
Call EnumDirectGroups(objUser)
Call EnumGroups(objUser)
objRecordset.MoveNext
Wend
set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.AppActivate "Zoekresultaten - Microsoft Internet Explorer"
End If
objConnection.Close
objDocument.Writeln "</body></html>"
objDocument.Write()
objDocument.Close
End Sub
Sub EnumDirectGroups(objUser)
objDocument.Writeln "<B>Direct lidmaatschap van:</B>"
Dim colGroups, objGroup, j
colGroups=objUser.memberOf
If IsEmpty(colGroups) Then
'wscript.echo "colgroups leeg"
Exit Sub
End If
For j = 0 To UBound(colGroups)
Set objGroup=GetObject("LDAP://" & colGroups(j))
objDocument.Writeln "<BR>" & objGroup.sAMAccountName
Next
objDocument.Writeln "<P><B>Alle groepen:</B>"
End Sub
Sub EnumGroups(objUser)
Dim colGroups, objGroup, j
colGroups=objUser.memberOf
If IsEmpty(colGroups) Then
'wscript.echo "colgroups leeg"
Exit Sub
End If
If TypeName(colGroups) = "String" Then
Set objGroup = GetObject("LDAP://" & colGroups)
objDocument.Writeln " - <B>>>></B> " & objGroup.sAMAccountName
Exit Sub
End If
For j = 0 To UBound(colGroups)
Set objGroup=GetObject("LDAP://" & colGroups(j))
objDocument.Writeln "<BR>" & objGroup.sAMAccountName
call EnumGroups(objGroup)
Next
End Sub 'EnumGroups