Visualizza messaggio singolo
Vecchio 12-02-2016, 20.00.14   #5
gutguy
Hero Member
 
L'avatar di gutguy
 
Registrato: 27-07-2004
Loc.: Bologna
Messaggi: 574
gutguy promette bene
Rif: [Win2000Server] Esportare elenco cartelle condivise con relative restrizioni

sono passati diversi anni, ma posto la soluzione al problema nel caso sia utile qlcn come lo è stato a me, detto cioè alla faccia della gente che dice che quando non esiste un tool bisogna farsi le cose a mano dico che nel 2016 (ma anche nel 2009 valeva lo stesso concetto) non è possibile pensare di farsi certe cose a mano (potrei estendere qst concetto anche ad altri ambiti per così dire meno strettamente informatici se sapete cosa intendo :P) sopratutto quando questo implica tempi e modi inaccettabili, ma ci pensate a scriversi 200 e passa utenti a mano su un foglio o farsi un printscreen? Tra l'altro inevitabilmente qlcs rimarrebbe perso per strada...

export.bat

Quota:
::To export all objects in the Marketing OU
ldifde -f marketing.ldf -s hq-res-dc-01-d"ou=Marketing,dc= reskit,dc=com"-psubtree–r"(objectCategory=CN=Person,CN=Schema,CN= Configuration,DC=reskit,DC=com)"
pause
export.vbs
Quota:
' The script searches the Marketing OU and creates a text file that lists all of the user objects
' and a subset of their attributes.
'Global variables
Dim oContainer
Dim OutPutFile
Dim FileSystem
'Initialize global variables
Set FileSystem = WScript.CreateObject("Scripting.FileSystemObject")
Set OutPutFile = FileSystem.CreateTextFile("marketing.txt", True)
SetoContainer=GetObject("LDAP://OU=marketing,DC=reskit,DC=com")
'Enumerate Container
EnumerateUsers oContainer
'Clean up
OutPutFile.Close
Set FileSystem = Nothing
Set oContainer = Nothing
WScript.Echo "Finished"
WScript.Quit(0)
Sub EnumerateUsers(oCont)
Dim oUser
For Each oUser In oCont
Select Case LCase(oUser.Class)
Case "user"
If Not IsEmpty(oUser.distinguishedName) Then
OutPutFile.WriteLine "dn: " & oUser.distinguishedName
End If
If Not IsEmpty(oUser.name) Then
OutPutFile.WriteLine "name: " & oUser.Get ("name")
End If
'need to do this because oUser.name would get back the Relative
Distinguished name (i.e. CN=Jo Brown)
If Not IsEmpty(oUser.st) Then
OutPutFile.WriteLine "st: " & oUser.st
End If
If Not IsEmpty(oUser.streetAddress) Then
OutPutFile.WriteLine "streetAddress: " & oUser.streetAddress
End If
Case "organizationalunit" , "container"
EnumerateUsers oUser
End Select
OutPutFile.WriteLine
Next
End Sub
gutguy non è collegato   Rispondi citando