LoganDecker84
MIS
Hello All
I use the below query to retrieve a username and extensionattribute7 from Active Directory. attrib7 contains version numbers of backup software installed on end user machines. i.e 6.2, 8.2.1 etc...
I would like to take the info from that attrib and find out how manu total versions of each one listed is, like there are ten 6.2's, fifty 8.2.1.
Is this possible?
Const ADS_UF_ACCOUNTDISABLE = 2
Set objConnection = CreateObject("ADODB.Connection")
Set objCommand = CreateObject("ADODB.Command")
objConnection.Provider = "ADsDSOOBject"
objConnection.Open "Active Directory Provider"
Set objCommand.ActiveConnection = objConnection
Set objRootDSE = GetObject("LDAP://RootDSE")
strDNSDomain = objRootDSE.Get("defaultNamingContext")
strBase = "<LDAP://" & strDNSDomain & ">"
strFilter = "(&(objectCategory=person)(objectClass=user))"
strAttributes = "distinguishedName,sAMAccountName,extensionattribute7,userAccountControl,DisplayName,mail"
strQuery = strBase & ";" & strFilter & ";" & strAttributes & ";subtree"
objCommand.CommandText = strQuery
objCommand.Properties("Page Size") = 1000
objCommand.Properties("Timeout") = 1000
objCommand.Properties("Cache Results") = False
Set objRecordSet = objCommand.Execute
objRecordSet.MoveFirst
Do Until objRecordSet.EOF
strDN = objRecordSet.Fields("distinguishedName")
strSAM = objRecordSet.Fields("samaccountName")
strattrib7 = objRecordSet.Fields("extensionattribute7").Value
intUAC = objRecordSet.Fields("userAccountControl")
Set objUser = GetObject("LDAP://" & strDN)
If objUser.AccountDisabled = False Then
If strtargetaddress <> "<Not Set>" Then
WScript.Echo strSAM & " ;" & strattrib7
Else
End IF
End If
objRecordSet.MoveNext
Loop
objConnection.Close
Any help is appreciated
I use the below query to retrieve a username and extensionattribute7 from Active Directory. attrib7 contains version numbers of backup software installed on end user machines. i.e 6.2, 8.2.1 etc...
I would like to take the info from that attrib and find out how manu total versions of each one listed is, like there are ten 6.2's, fifty 8.2.1.
Is this possible?
Const ADS_UF_ACCOUNTDISABLE = 2
Set objConnection = CreateObject("ADODB.Connection")
Set objCommand = CreateObject("ADODB.Command")
objConnection.Provider = "ADsDSOOBject"
objConnection.Open "Active Directory Provider"
Set objCommand.ActiveConnection = objConnection
Set objRootDSE = GetObject("LDAP://RootDSE")
strDNSDomain = objRootDSE.Get("defaultNamingContext")
strBase = "<LDAP://" & strDNSDomain & ">"
strFilter = "(&(objectCategory=person)(objectClass=user))"
strAttributes = "distinguishedName,sAMAccountName,extensionattribute7,userAccountControl,DisplayName,mail"
strQuery = strBase & ";" & strFilter & ";" & strAttributes & ";subtree"
objCommand.CommandText = strQuery
objCommand.Properties("Page Size") = 1000
objCommand.Properties("Timeout") = 1000
objCommand.Properties("Cache Results") = False
Set objRecordSet = objCommand.Execute
objRecordSet.MoveFirst
Do Until objRecordSet.EOF
strDN = objRecordSet.Fields("distinguishedName")
strSAM = objRecordSet.Fields("samaccountName")
strattrib7 = objRecordSet.Fields("extensionattribute7").Value
intUAC = objRecordSet.Fields("userAccountControl")
Set objUser = GetObject("LDAP://" & strDN)
If objUser.AccountDisabled = False Then
If strtargetaddress <> "<Not Set>" Then
WScript.Echo strSAM & " ;" & strattrib7
Else
End IF
End If
objRecordSet.MoveNext
Loop
objConnection.Close
Any help is appreciated