How to I identify "User must change password at next logon" attribute in Active Directory

I simply want to enumerate the accounts in active directory that have the "User must change password at next logon" box checked. I have attached a bitmap to show you what I am refering to and the code for enumeration is included. Prefereably the solution should be in vbscript or vb.
SelectValue = "REGIS T. HYDE"
SetLdapRecordSource CnUserRs, CnUserCn, SelectValue, 1 
 
Do While Not CnUserRs.EOF 
 
WScript.Echo CnUserRs.Fields("pwdLastSet").value
 
CnUserRs.Movenext
Loop
CloseTables CnUserRs,CnUserCn
 
 
 
 
 
Sub Get_Record_Set(ByRef RsVal)
 
'***********************'
'*       Summary       *'
'***********************'
'****************************************************************************'
'*    This module will create an ado recordset object. It basically sets    *'
'*    aside memory allocation for the source that will be used for data     *'
'*    manipulation.                                                         *'
'****************************************************************************'
   
    Set RsVal = CreateObject("ADODB.Recordset")
        
End Sub
 
 
 
Sub SetLdapRecordSource(ByRef RsTemp, ByRef cnTemp,ByRef SelectValue, ByRef CaseTemp)
    
    Get_Record_Set RsTemp
    Open_LdapConnection RsTemp, cnTemp
    Select_Source RsTemp, SelectValue, CaseTemp
   
End Sub
 
 
 
Sub Open_LdapConnection(ByRef RsVal1, ByRef cnTemp)
 
'***********************'
'*       Summary       *'
'***********************'
'****************************************************************************'
'*    This module will create an ado connection object. It basically allows *'
'*    the recordset to attach to the appropriate ldap data source.          *'
'****************************************************************************'
   
    Const ADS_SCOPE_SUBTREE = 2
    
    Set cnTemp = CreateObject("ADODB.Connection")
    cnTemp.ConnectionString = "Provider=ADsDSOObject"
    cnTemp.Open
   
    RsVal1.ActiveConnection = cnTemp
    'RsVal1.Properties("searchscope") = ADS_SCOPE_SUBTREE
    
    RsVal1.Properties("Page Size") = 1000
    RsVal1.Properties("Timeout") = 30  
    RsVal1.Properties("Searchscope") = ADS_SCOPE_SUBTREE 
    RsVal1.Properties("Cache Results") = False 
    
    
    
    
    RsVal1.CursorLocation = 3
    RsVal1.LockType = 3
   
    
End Sub
 
 
 
Sub Select_Source(ByRef RsVal, Byref SelectValue ,ByVal SourceNum)
 
 
 
Select Case SourceNum
 
 
 
Case 1
         
          RsVal.Source ="<LDAP://DC=winroot,DC=svmh,DC=com>;" & _   
          "(&(objectCategory=person)(objectClass=user)(cn=" & SELECTVALUE & "));" & _ 
          "cn,pwdLastSet,distinguishedName,SamaccountName,extensionAttribute1,msExchHomeServerName,mail;subtree" 
          RsVal.Sort = "cn ASC" 
          
 
            
        End Select
    
  
  
  RsVal.Open
  If RsVal.EOF Then
    Exit Sub
  End If
  RsVal.MoveFirst
  
 
            
    
End Sub
 
 
 
 
 
Sub CloseTables(ByRef RsVal1, ByRef cnTemp)
    RsVal1.Close
    cnTemp.Close
    Set RsVal1 = Nothing
    Set cnTemp = Nothing
End Sub

Open in new window

AD-USER.bmp
BLACK THANOSAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

DonNetwork AdministratorCommented:
0
BLACK THANOSAuthor Commented:
i figured it out. I will post the code tomorrow. It CAN BE DONE.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Development

From novice to tech pro — start learning today.