AD nach
Hallo,
ich suche eine Möglichkeit das AD bei WIN2003 nach Benutzer zu durchsuchen die als Einstellung Kennwort läuft nie ab haben.
Wie kann ich das am einfachsten umsetzen...?
Ich bin für jeden Lösungsansatz dankbar .....
Josef
ich suche eine Möglichkeit das AD bei WIN2003 nach Benutzer zu durchsuchen die als Einstellung Kennwort läuft nie ab haben.
Wie kann ich das am einfachsten umsetzen...?
Ich bin für jeden Lösungsansatz dankbar .....
Josef
Please also mark the comments that contributed to the solution of the article
Content-Key: 50612
Url: https://administrator.de/contentid/50612
Printed on: April 24, 2024 at 00:04 o'clock
2 Comments
Latest comment
Hallo josef_69!
Versuch mal folgendes VBScript:
Wenn Du unter dem Namen "ListNoPwdExpire.vbs" speicherst, kannst Du das Script per Doppelklick oder besser von der Kommandozeile so aufrufen:
Damit wird die Liste in die Textdatei "NichtAblaufendePW.txt" geschrieben. Als Trennzeichen zwischen Kontonamen und DistinguishedName habe ich ein Tabulatorzeichen eingesetzt. Falls Du zB ";" bevorzugst, könntest Du folgende Zeile ersatzweise einbauen:
Grüße
bastla
Versuch mal folgendes VBScript:
'ListNoPwdExpire.vbs
'
' Adaptierte Version von:
' PwdLastChanged.vbs
' Copyright (c) 2003 Richard L. Mueller
' Hilltop Lab web site - http://www.rlmueller.net
Const ADS_UF_PASSWD_CANT_CHANGE = &H40
Const ADS_UF_DONT_EXPIRE_PASSWD = &H10000
' Use ADO to search the domain for all users.
Set adoConnection = CreateObject("ADODB.Connection")
Set adoCommand = CreateObject("ADODB.Command")
adoConnection.Provider = "ADsDSOOBject"
adoConnection.Open "Active Directory Provider"
Set adoCommand.ActiveConnection = adoConnection
' Determine the DNS domain from the RootDSE object.
Set objRootDSE = GetObject("LDAP://RootDSE")
strDNSDomain = objRootDSE.Get("DefaultNamingContext")
' Filter to retrieve all user objects.
strFilter = "(&(objectCategory=person)(objectClass=user))"
strQuery = "<LDAP://" & strDNSDomain & ">;" & strFilter _
& ";sAMAccountName,distinguishedName,pwdLastSet,userAccountControl;subtree"
adoCommand.CommandText = strQuery
adoCommand.Properties("Page Size") = 100
adoCommand.Properties("Timeout") = 30
adoCommand.Properties("Cache Results") = False
strOut = ""
' Enumerate all users
Set adoRecordset = adoCommand.Execute
Do Until adoRecordset.EOF
strAN = adoRecordset.Fields("sAMAccountName")
strDN = adoRecordset.Fields("distinguishedName")
lngFlag = adoRecordset.Fields("userAccountControl")
blnPwdExpire = True
If ((lngFlag And ADS_UF_PASSWD_CANT_CHANGE) <> 0) Then
blnPwdExpire = False
End If
If ((lngFlag And ADS_UF_DONT_EXPIRE_PASSWD) <> 0) Then
blnPwdExpire = False
End If
If Not blnPwdExpire Then
strOut = strOut & strAN & vbTab & strDN & vbCrLF
End If
adoRecordset.MoveNext
Loop
Wscript.Echo strOut
' Clean up.
adoConnection.Close
Set objFile = Nothing
Set objFSO = Nothing
Set objShell = Nothing
Set adoConnection = Nothing
Set adoCommand = Nothing
Set objRootDSE = Nothing
Set adoRecordset = Nothing
cscript //nologo ListNoPwdExpire.vbs > NichtAblaufendePW.txt
strOut = strOut & strAN & ";" & strDN & vbCrLF
Grüße
bastla