Добро пожаловать в форум, Guest  >>   Войти | Регистрация | Поиск | Правила | В избранное | Подписаться
Все форумы / Microsoft SQL Server Новый топик    Ответить
 LDAP, выборка пользователей из группы и получение их memberOf  [new]
aptom
Member

Откуда:
Сообщений: 102
Здравствуйте господа, есть такая проблема: я выбираю запросом пользователей и получаю их значения, но только те которые стринг, те значения которые являются объектом обработать не получается, кто нить знает как сними работать. Если говорить грубее то у контейнера есть внутри контейнер- как с ним работать не понятно.
12 сен 11, 07:33    [11261953]     Ответить | Цитировать Сообщить модератору
 Re: LDAP, выборка пользователей из группы и получение их memberOf  [new]
aptom
Member

Откуда:
Сообщений: 102
aptom, если кому надо расскажу как это сделать
16 сен 11, 12:14    [11286556]     Ответить | Цитировать Сообщить модератору
 Re: LDAP, выборка пользователей из группы и получение их memberOf  [new]
лорпа
Guest
кусок кода
EXEC master.dbo.sp_addlinkedserver 
 @server = N'ADSI',
 @srvproduct=N'Active Directory Services 2.5',
 @provider=N'ADSDSOObject',
 @datasrc=N'adsdatasource'
GO

CREATE TABLE [dbo].[ADobjPRE](
	[objectGUID] [uniqueidentifier] NOT NULL,
	[distinguishedName] [nvarchar](256) NOT NULL,
	[DisplayName] [nvarchar](4000) NULL,
	[objectCategory] [nvarchar](256) NULL,
	[groupType] [binary](8) NULL,
	[samAccountType] [int] NULL,
	[UserAccountControl] [int] NULL,
	[ADsPath] [nvarchar](256) NULL,
	[objectSID] [varbinary](256) NULL,
	[sAMAccountName] [nvarchar](256) NULL,
	[Drink] [nvarchar](4000) NULL,
	[whenCreated] [datetime] NULL,
	[lastLogon] [nvarchar](4000) NULL,
	[Name] [nvarchar](256) NULL,
	[Cn] [nvarchar](256) NULL,
	[photo] [nvarchar](4000) NULL,
	[managedBy] [nvarchar](256) NULL,
	[givenName] [nvarchar](256) NULL,
	[middleName] [nvarchar](256) NULL,
	[Sn] [nvarchar](256) NULL,
	[Initials] [nvarchar](256) NULL,
	[title] [nvarchar](256) NULL,
	[mail] [nvarchar](256) NULL,
	[physicalDeliveryOfficeName] [nvarchar](256) NULL,
	[streetAddress] [nvarchar](256) NULL,
	[countryCode] [int] NULL,
	[postOfficeBox] [nvarchar](4000) NULL,
	[L] [nvarchar](256) NULL,
	[St] [nvarchar](256) NULL,
	[C] [nvarchar](256) NULL,
	[Co] [nvarchar](256) NULL,
	[postalCode] [nvarchar](256) NULL,
	[TelephoneNumber] [nvarchar](256) NULL,
	[facsimileTelephoneNumber] [nvarchar](256) NULL,
	[mobile] [nvarchar](256) NULL,
	[ipPhone] [nvarchar](256) NULL,
	[homePhone] [nvarchar](256) NULL,
	[pager] [nvarchar](256) NULL,
	[profilePath] [nvarchar](256) NULL,
	[scriptPath] [nvarchar](256) NULL,
	[info] [nvarchar](256) NULL,
	[homeDrive] [nvarchar](256) NULL,
	[homeDirectory] [nvarchar](256) NULL,
	[manager] [nvarchar](256) NULL,
	[company] [nvarchar](256) NULL,
	[department] [nvarchar](256) NULL,
	[departmentNumber] [nvarchar](4000) NULL,
	[division] [nvarchar](256) NULL,
	[employeeID] [nvarchar](256) NULL,
	[employeeNumber] [nvarchar](256) NULL,
	[employeeType] [nvarchar](256) NULL,
	[Enabled] [tinyint] NULL
) ON [PRIMARY]
GO

INSERT INTO [dbo].[ADobjPRE]
         ([DisplayName], [objectGUID], [distinguishedName], [objectCategory], [groupType], [samAccountType], [UserAccountControl], [ADsPath], [objectSID], [sAMAccountName], [Drink], [whenCreated], [lastLogon], [Name], [Cn], [photo], [managedBy], [givenName], [middleName], [Sn], [Initials], [title], [mail], [physicalDeliveryOfficeName], [streetAddress], [countryCode], [postOfficeBox], [L], [St], [C], [Co], [postalCode], [TelephoneNumber], [facsimileTelephoneNumber], [mobile], [ipPhone], [homePhone], [pager], [profilePath], [scriptPath], [info], [homeDrive], [homeDirectory], [manager], [company], [department], [departmentNumber], [division], [employeeID], [employeeNumber], [employeeType], [Enabled])
SELECT [DisplayName], [objectGUID], [distinguishedName], [objectCategory], [groupType], [samAccountType], [UserAccountControl], [ADsPath], [objectSID], [sAMAccountName], [Drink], [whenCreated], [lastLogon], [Name], [Cn], [photo], [managedBy], [givenName], [middleName], [Sn], [Initials], [title], [mail], [physicalDeliveryOfficeName], [streetAddress], [countryCode], [postOfficeBox], [L], [St], [C], [Co], [postalCode], [TelephoneNumber], [facsimileTelephoneNumber], [mobile], [ipPhone], [homePhone], [pager], [profilePath], [scriptPath], [info], [homeDrive], [homeDirectory], [manager], [company], [department], [departmentNumber], [division], [employeeID], [employeeNumber], [employeeType], [Enabled]
FROM OpenQuery (ADSI, '<LDAP://domain.ru/OU=Test_Groups,DC=domain,DC=ru>;;
         DisplayName, objectCategory, groupType, samAccountType, UserAccountControl, ADsPath, distinguishedName, objectGUID, objectSID, sAMAccountName, Drink, whenCreated, lastLogon, Name, Cn, photo, managedBy, givenName, middleName, Sn, Initials, title, mail, physicalDeliveryOfficeName, streetAddress, countryCode, postOfficeBox, L, St, C, Co, postalCode, TelephoneNumber, facsimileTelephoneNumber, mobile, ipPhone, homePhone, pager, profilePath, scriptPath, info, homeDrive, homeDirectory, manager, company, department, departmentNumber, division, employeeID, employeeNumber, employeeType, Enabled
         ;subtree')
ORDER BY reverse(objectCategory), reverse(distinguishedName)
GO
16 сен 11, 22:59    [11291324]     Ответить | Цитировать Сообщить модератору
Все форумы / Microsoft SQL Server Ответить