This works for one user...how do i change it to pull all users from this OU along with expiration dates?
On Error Resume Next
Set objUser = GetObject _
("LDAP://cn=username,OU=A-E,OU=VendorsContractors,DC=resource,DC=domain,DC=domain,DC=com")
dtmAccountExpiration = objUser.AccountExpirationDate
If Err.Number = -2147467259 Or dtmAccountExpiration = "1/1/1970" Then
WScript.Echo "No account expiration date specified"
'Else
' WScript.Echo "Account expiration date: " & objUser.AccountExpirationDate
End If
getExpireDate = objUser.AccountExpirationDate
On Error Resume Next
Set objUser = GetObject _
("LDAP://cn=username,OU=A-E,OU=VendorsContractors,DC=resource,DC=domain,DC=domain,DC=com")
dtmAccountExpiration = objUser.AccountExpirationDate
If Err.Number = -2147467259 Or dtmAccountExpiration = "1/1/1970" Then
WScript.Echo "No account expiration date specified"
'Else
' WScript.Echo "Account expiration date: " & objUser.AccountExpirationDate
End If
getExpireDate = objUser.AccountExpirationDate