Forum |  HardWare.fr | News | Articles | PC | S'identifier | S'inscrire | Shop Recherche
3087 connectés 

 


Dernière réponse
Sujet : [AD] Liste des comptes verrouillés
c_moa Avec un p'tit script VBS
( source : Technet de Microsoft : script center )
 
 
 
Locating All the Disabled User Accounts in Active Directory
 
Description
Returns a list of all disabled user accounts in the fabrikam.com domain.
 
For more information about searching Active Directory, click here.
 
Supported Platforms
Windows Server 2003  Yes
 
Windows XP Yes
 
Windows 2000  Yes
 
Windows NT 4.0  Yes, with Active Directory Client Extensions installed
 
Windows 98  Yes, with Active Directory Client Extensions installed
 
 
 
 
Script Code  
 

Citation :


Const ADS_UF_ACCOUNTDISABLE = 2
 
Set objConnection = CreateObject("ADODB.Connection" )
objConnection.Open "Provider=ADsDSOObject;"
Set objCommand = CreateObject("ADODB.Command" )
objCommand.ActiveConnection = objConnection
objCommand.CommandText = _
    "<GC://dc=fabrikam,dc=com>;(objectCategory=User)" & ";userAccountControl,distinguishedName;subtree"  
Set objRecordSet = objCommand.Execute
 
intCounter = 0
While Not objRecordset.EOF
    intUAC=objRecordset.Fields("userAccountControl" )
    If intUAC AND ADS_UF_ACCOUNTDISABLE Then
        WScript.echo objRecordset.Fields("distinguishedName" ) & " is disabled"
        intCounter = intCounter + 1
    End If
    objRecordset.MoveNext
Wend
 
WScript.Echo VbCrLf & "A total of " & intCounter & " accounts are disabled."
 
objConnection.Close


Votre réponse
Nom d'utilisateur    Pour poster, vous devez être inscrit sur ce forum .... si ce n'est pas le cas, cliquez ici !
Le ton de votre message                        
                       
Votre réponse


[b][i][u][strike][spoiler][fixed][cpp][url][email][img][*]   
 
   [quote]
 

Options

 
Vous avez perdu votre mot de passe ?


Vue Rapide de la discussion
c_moa Avec un p'tit script VBS
( source : Technet de Microsoft : script center )
 
 
 
Locating All the Disabled User Accounts in Active Directory
 
Description
Returns a list of all disabled user accounts in the fabrikam.com domain.
 
For more information about searching Active Directory, click here.
 
Supported Platforms
Windows Server 2003  Yes
 
Windows XP Yes
 
Windows 2000  Yes
 
Windows NT 4.0  Yes, with Active Directory Client Extensions installed
 
Windows 98  Yes, with Active Directory Client Extensions installed
 
 
 
 
Script Code  
 

Citation :


Const ADS_UF_ACCOUNTDISABLE = 2
 
Set objConnection = CreateObject("ADODB.Connection" )
objConnection.Open "Provider=ADsDSOObject;"
Set objCommand = CreateObject("ADODB.Command" )
objCommand.ActiveConnection = objConnection
objCommand.CommandText = _
    "<GC://dc=fabrikam,dc=com>;(objectCategory=User)" & ";userAccountControl,distinguishedName;subtree"  
Set objRecordSet = objCommand.Execute
 
intCounter = 0
While Not objRecordset.EOF
    intUAC=objRecordset.Fields("userAccountControl" )
    If intUAC AND ADS_UF_ACCOUNTDISABLE Then
        WScript.echo objRecordset.Fields("distinguishedName" ) & " is disabled"
        intCounter = intCounter + 1
    End If
    objRecordset.MoveNext
Wend
 
WScript.Echo VbCrLf & "A total of " & intCounter & " accounts are disabled."
 
objConnection.Close

freds45 [:drapo] m'intéresse aussi ! :)
AGA Salut,
 
existe t'il un moyen d'obtenir la liste des comptes verrouillés de l'AD à un instant T.
(et autres outils de ce genre?)
 
Merci.

Copyright © 1997-2025 Groupe LDLC (Signaler un contenu illicite / Données personnelles)