Domino 9 und frühere Versionen > ND6: Entwicklung

ADO und Username.Filter = Array("User")

<< < (3/4) > >>

koehlerbv:
Wenn man das zum Fliegen bringt, sehe ich aber immer noch ein Problem: Was ist, wenn es in der Domäne zu viele User gibt, um sie in einem Array abzulegen ? Dieses ist ja arg endlich mit seiner Speicherkapazität ...

Leider fallen mir aber derzeit keine alternativen Möglichkeiten ein, um die User auszulesen.

Bernhard

robertpp:
Hallo nach eine kurzen Pause retour.
@thomas: Das Script läuft bereits aber es liefert mir ein anderes Ergebnis weil ich das Filtern auf "User" nicht durchführen kann.
Das heisst ich denke an dem kann es nicht liegen:
Set UserName = GetObject("WinNT://" & ComputerName & ",computer")

@Andreas: hab ich schon gelesen wie Bernhard es auch schon gesagt hat aber ich denke es könnte der richtige Weg sein aber wie weiß ich (noch) nicht!

@Bernhard: ich lege die user ja nicht in ein Array sondern ich erzeuge gleich für jeden user ein doc.

Ich denke dieser Befehl:
UserName.Filter = Array("User")
filtert einfach aus dem UserName alle einträge die ein "User" sind.

robert

Glombi:
Also es ist:

IADsContainer Property
The one read-only property in IADsContainer lets you read the object classes specified in the Filter method.

• IADsContainer::Filter. This property returns the class of objects being filtered in a container enumeration.

IADsContainer::Filter is also considered a method because you use it to set the Filter property on a container object to be enumerated. Therefore, to separate the property from the method, the property is referred to as get_Filter because it reads the value of the filter. The method is referred to as put_Filter because it sets or writes the value of the filter.
 


Array erstellt auf einfache Weise in VB ein Array. Du brauchst aber kein Array. Also müsste es so gehen:


Const ComputerName = "srveb01"
   Const domain = "//ATEBD1"

   Dim s As New NotesSession
   Dim db As NotesDatabase
   Dim doc As NotesDocument
   Set db = s.CurrentDatabase
   
dim UserName as variant

   Set UserName = GetObject("WinNT://" & ComputerName & ",computer")
   UserName.Filter = "User"
   
   Forall users In UserName
      On Error Resume Next
      user = users.Name
      Set oUser = GetObject("WinNT:" & domain & "/" & user)
     
      Set doc = db.CreateDocument
      doc.Form = "activedirectory"
      doc.ShortName = oUser.Name
      doc.FullName = oUser.FullName
      doc.Department =oUser.Description
      doc.LastLogin = oUser.LastLogin
      If oUser.AccountDisabled <> False Then
         doc.AccountDisabled =  "True"
      End If
      If oUser.IsAccountLocked <> False Then
         doc.AccountLocked = "True"   
      End If
      doc.ValidFrom = Int(oUser.PasswordAge/3600/24)
      Call doc.Save(True, False)     
   End Forall

robertpp:
Hallo Andreas,

Das hab ich auch schon ausprobiert hat dann keinen fehler mehr ausgegeben jedoch nicht das gleiche Ergebnis geliefert es haben dann immer einig User gefehlt was mir jedoch unerklärlich war.

robertpp:
Hat niemand mehr eine Idee wie ich mein UserName.Filter = Array("User") zum laufen bekomme?

Ich hab hier jetzt nochmals eine unterschied bemerkt:
Getestet mit vbs-Script

DisplayObjects "LDAP://atebd1", ""

Function DisplayObjects( strADsPath, strSpace)

   set objObject = GetObject(strADsPath)
   Wscript.Echo strSpace & strADsPath
   objObject.Filter = Array("organizationalUnit")
   for each objChildObject in objObject
      DisplayObjects objChildObject.ADsPath, strSpace & " "
   next

End Function
Liefert mir alle OU einer Domain. ( EDV, PER, FE,... usw)



Gegensatz:

DisplayObjects "LDAP://atebd1", ""

Function DisplayObjects( strADsPath, strSpace)

   set objObject = GetObject(strADsPath)
   Wscript.Echo strSpace & strADsPath
   objObject.Filter = "organizationalUnit"
   for each objChildObject in objObject
      DisplayObjects objChildObject.ADsPath, strSpace & " "
   next

End Function
Hingegen liefert mir das Script alle Einträge aus dem AD. ( User Groups, Computer,....usw.) das heisst er ignoriert diesen Eintrag.

Das heisst ich muss es irgendwie hinbekommen es mit Array zu machen.

Vielleicht weiß ja jemand ob das "User" oder "organizationalUnit" im Active Directory in einem Feld steht auf das man abfragen kann.

Navigation

[0] Themen-Index

[#] Nächste Seite

[*] Vorherige Sete

Zur normalen Ansicht wechseln