Alterar a parte do donínio e salvar no notepad em VBS:

‘Global variables
Dim oContainer
Dim OutPutFile
Dim FileSystem

‘Initialize global variables
Set FileSystem = WScript.CreateObject(“Scripting.FileSystemObject”)
Set OutPutFile = FileSystem.CreateTextFile(“Saida.txt”, True)

OutPutFile.WriteLine “OU” & vbtab & “Full Name” & vbtab & “Display Name” & vbtab & “User Name” & vbtab & “Script Logon” & vbtab & “Description” & vbtab & “Office” & vbtab & “Phone Number” & vbtab & “Company” & vbtab & “Account Status” & vbtab & “Dial-in”

Set oContainer = GetObject(“LDAP://DC=matone,DC=local“)

‘Enumerate Container
EnumerateUsers oContainer

‘Clean up
OutPutFile.Close
Set FileSystem = Nothing
Set oContainer = Nothing
WScript.echo “Finish!!!”
WScript.Quit(0)

Sub EnumerateUsers(oCont)
     Dim oUser, bUser
     For Each oUser In oCont
          bUser = False
          Select Case LCase(oUser.Class)
          Case “user”
              bUser = True
              OutPutFile.Write oUser.distinguishedName & vbtab
              OutPutFile.Write oUser.displayName & vbtab
              OutPutFile.Write OUser.name & vbtab
              OutPutFile.Write oUser.sAMAccountName & vbtab
              OutPutFile.Write oUser.scriptPath & vbtab
              OutPutFile.Write oUser.description & vbtab
              OutPutFile.Write oUser.physicalDeliveryOfficeName & vbtab
              OutPutFile.Write oUser.telephoneNumber & vbtab
              OutPutFile.Write oUser.company & vbtab
              OutPutFile.Write oUser.userAccountControl & vbtab
              OutPutFile.Write oUser.msNPAllowDialin & vbtab

               Case “organizationalunit”, “container”
                    EnumerateUsers oUser
          End Select
          If bUser Then
               OutPutFile.WriteLine
          End If
     Next
End Sub

Anúncios