May 19, 2005 at 5:44 pm
I'm trying to get the member info out of Active Directory all I need is the login name and the groups they are a member of and I keep getting the following error:
Server: Msg 7346, Level 16, State 2, Line 1
Could not get the data of the row from the OLE DB provider 'ADSDSOObject'. Could not convert the data value due to reasons other than sign mismatch or overflow.
OLE DB error trace [OLE/DB Provider 'ADSDSOObject' IRowset::GetData returned 0x40eda: Data status returned from the provider: [COLUMN_NAME=adspath STATUS=DBSTATUS_S_OK], [COLUMN_NAME=memberOf STATUS=DBSTATUS_E_CANTCONVERTVALUE], [COLUMN_NAME=department STATUS=DBSTATUS_S_OK], [COLUMN_NAME=mail STATUS=DBSTATUS_S_OK], [COLUMN_NAME=title STATUS=DBSTATUS_S_OK], [COLUMN_NAME=company STATUS=DBSTATUS...
SELECT *
INTO TMP_AD
FROM OpenQuery(
ADSI,'<;(&(objectCategory=Group">LDAP://chad/DC=companyname,DC=com,DC=au>;(&(objectCategory=Group));
displayName, description;subtree')
Is there a way I can get this info from AD?
Thanks for your help in advance.
Kris
May 20, 2005 at 1:14 am
The "[COLUMN_NAME=memberOf STATUS=DBSTATUS_E_CANTCONVERTVALUE]," is the cause of the error here. The data seems to be stored in weird formats for some fields in Active Directory. How you go about converting the information is beyond me. If you find out I'd like to know as well.
--------------------
Colt 45 - the original point and click interface
May 20, 2005 at 4:58 pm
I use the following vbscript that is scheduled to run nightly and it fills SQL tables with data from ADSI. Then our webpage can display it out of the SQL tables. Don't know if this will help, but here you go:
Dim sArray(10000,2)
Dim sEmailArray(1000,2)
Dim iCount
Dim iCountEmail
Dim objConn
On Error Resume Next
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' set up connection to Active Directory
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Set ADSIRootDSE = GetObject("LDAP://RootDSE")
Set ADSIConnection = CreateObject("ADODB.Connection")
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' get recordset of all Groups in Active Directory
' this will get Distribution Groups & Security Groups
' but we'll bypass Security Groups below
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Set ADSICommand = CreateObject("ADODB.Command")
Set ADSICommand.ActiveConnection = ADSIConnection
False
Set ADSIResult = ADSICommand.Execute
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' loop through list of Groups
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Do While not ADSIResult.EOF
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' get the name,distinguishedName,groupType attributes
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' we only want Distribution Groups (exclude Security Groups)
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''
If iGroupType > 0 Then
'''''''''''''''''''''''''''''''''''''''''''''''''''''
' put data into array to write to tblDistGroups
'''''''''''''''''''''''''''''''''''''''''''''''''''''
'''''''''''''''''''''''''''''''''''''''''''''''''''''
' get all members of the Group
'''''''''''''''''''''''''''''''''''''''''''''''''''''
Set GetDN = GetObject("LDAP://" & sDistinguishedName)
For each strValue in strAllValues
If Len(strValue) = 0 Then
'''''''''''''''''''''''''''''''''''''''''''''
' skip it since there are no members in this group
'''''''''''''''''''''''''''''''''''''''''''''
Else
'''''''''''''''''''''''''''''''''''''''''''''
' get the User's LoginName from sAMAccountName
'''''''''''''''''''''''''''''''''''''''''''''
Set objUser = GetObject( "LDAP://" & strValue )
Set objUser = Nothing
'''''''''''''''''''''''''''''''''''''''''''''
' and populate sArray with sGroupName,sLoginName
'''''''''''''''''''''''''''''''''''''''''''''
End If
Next
Set strAllValues = Nothing
End If
Loop
Set ADSIConnection = Nothing
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' open connection to SQL Server WEB database and clear tables
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Set objConn = CreateObject("ADODB.Connection")
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' put data from sEmailArray into SQL table tblDistGroups
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
For i = 0 to iCountEmail - 1
Next
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' put data from sArray into SQL table tblDistGroupMembers
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
For i = 0 to iCount - 1
Next
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' close up and get outahere
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Set objConn = Nothing
'MsgBox("finished and do not forget to get rid of this MsgBox and reenable On Error Resume Next")
Stop
July 21, 2005 at 8:34 am
another solution:
Get group distinguishedname:
SELECT name,distinguishedname
FROM OPENQUERY( ADSI,
'SELECT Name, distinguishedname
FROM ''LDAP://xxxxxxx/DC=xxxx,DC=COM,DC=BR''
WHERE objectCategory = ''GROUP'' and CN = ''*FILTER*''')
order by name
Get group membership:
SELECT samaccountname,Name
FROM OPENQUERY( ADSI,
'SELECT samaccountname,Name
FROM ''LDAP://xxxxxxx/DC=xxxx,DC=COM,DC=BR''
WHERE objectCategory = ''user'' and memberof = ''group distinguishedname'' ')
order by name
[]s
Larangeira
March 12, 2007 at 2:15 pm
look at this microsoft´s article
March 11, 2008 at 2:36 pm
Meu Email Dois (7/21/2005)
another solution:
Get group distinguishedname:
SELECT name,
FROM OPENQUERY( ADSI,
'SELECT Name, distinguishedname
FROM ''LDAP://
WHERE objectCategory = ''GROUP'' and CN = ''* *''')
order by name
Get group membership:
SELECT samaccountname,Name
FROM OPENQUERY( ADSI,
'SELECT samaccountname,Name
FROM ''LDAP://
WHERE objectCategory = ''user'' and memberof = '' '' ')
order by name
[]s
Larangeira
Just wanted to say that this was the resolution for me. I had read the MS KB article before and thought I was going to have to go down that route. I setup a view that returns members of a specified CN. Thanks for your advice.
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply