List disabled User

listdisabledUser.vbs
 ' alle Benutzer der Firma mit Passwortablauf
 Dim oUser
i = 0
dom = "MYNTDOM" ' NT-Domänenname
dcsrv = "mydomctrl" ' domänencontroller
	'Create Container-Object for reading User
   	Set oUser = GetObject("WinNT://" & dom & "/" & dcsrv)
   	' Set filter to get User only
   	oUser.Filter = Array("User")
 
        For Each oChildUser In oUser
 
    GetDisabledUser dom , oChildUser.Name
 
  Next
' -------------------------------------------------------------------------
' abgelaufene Benutzer
' -------------------------------------------------------------------------
Sub GetDisabledUser(strDomain,strUser)
  Dim User
  Dim Ablaufzeit
 
    Set User = GetObject("WinNT://" & strDomain & "/" & strUser & ",user")
 
'	Ablaufzeit = User.PasswordExpirationDate - Date()
 
    if	User.AccountDisabled  then
 
	WScript.Echo User.AccountDisabled & " " & User.Fullname
	'WScript.Echo i & " " &User.Name & " " & User.Fullname & " " &	User.PasswordExpirationDate 
	else
	'WScript.Echo vbTab & User.AccountDisabled & " " & User.Fullname
  end if
 
  End Sub


zurück