Monday, March 26, 2012

How to get the OU information on a usr into my SQL VIew

Hi
I am reading AD Users, who are organised in different OU in my AD.
In the OU i have some organisational information that i would like to link
together
with my AD Users when i make my SQL view.
How can i join these 2 information in my SQL View ?Could you please provide schema, data and expected results.
Thanks
Peter
"sdane" wrote:

> Hi
> I am reading AD Users, who are organised in different OU in my AD.
> In the OU i have some organisational information that i would like to link
> together
> with my AD Users when i make my SQL view.
> How can i join these 2 information in my SQL View ?|||sure thing,
I have a domain int.dem.local
here i have a OU called Finance Department. On the OU there are info like
City=Roskilde and State/Proviens=2. Floor.
In the OU i have some users with the normal fields filled out like first
name, last
name, User Logon name.
In the AD these information is kept in 2 places. I would like to have a SQL
View
that shows me records like
first name, last name, User Logon name, (OU) City, (OU) State/provins
This way i can maintaine the generel information about my users location a
single
place and still have all the information in one record in my sql.
Is this possible ?
Is this want you were asking for ?
"Peter Nolan" wrote:
> Could you please provide schema, data and expected results.
> Thanks
> Peter
> "sdane" wrote:
>|||Apologies for not getting back sooner, minor problem to sort out.
I think we are talking cross purposes here. For any view to work it needs to
be in a SQL Table with data in it, I do not think it can be otherwise unless
its part of a linked server.
So could you provide some table structure i.e.what it looks like in SQL
Server tables, and possibly some play data.
Peter
"sdane" wrote:
> sure thing,
> I have a domain int.dem.local
> here i have a OU called Finance Department. On the OU there are info like
> City=Roskilde and State/Proviens=2. Floor.
> In the OU i have some users with the normal fields filled out like first
> name, last
> name, User Logon name.
> In the AD these information is kept in 2 places. I would like to have a SQ
L
> View
> that shows me records like
> first name, last name, User Logon name, (OU) City, (OU) State/provins
> This way i can maintaine the generel information about my users location a
> single
> place and still have all the information in one record in my sql.
> Is this possible ?
> Is this want you were asking for ?
> "Peter Nolan" wrote:
>|||I am using ADSI til make a linked server to connect to my active directory.
And then i have a SQLView to get the data from a user in the AD.
The AD user info is
givenname = Hans
sn = Jensen
SAMAccountname = dom.hans
This user is located in a Organisational Unit (OU) in my AD. On this OU ther
e
are info like
OU = Brugere
City = Copenhagen
State/Provinse = 2.Floor
What i want is to make a SQL View that can give me records were these two
pieces of info is joined into one record like
givenName sn SAMAccountname City
State/Provinse
----
--
Hans Jensen dom.hans Copenhagen 2.Floor
I made my Linked ser with these sql scripts:
sp_addlinkedserver 'ADSI', 'Active Directory Services 2.5', 'ADSDSOObject',
'DomServer'
sp_addlinkedsrvlogin ADSI, false, 'sa', 'AD_Reader', 'Reader'
After this a make the SQL view using this sql script:
create view v_ADSI(SAMAccountName, givenname, sn)as
SELECT * FROM OpenQuery(
ADSI_INST,'<LDAP://ou=Brugere,dc=lpb,dc=local>;(&(objectCategory=Person)(obj
ectClass=user));SAMAccountName, givenname,sn;subtree')
This gives me the ad users info, but have do i get the OU info and link it
with the
user info.
"Peter Nolan" skrev:
> Apologies for not getting back sooner, minor problem to sort out.
> I think we are talking cross purposes here. For any view to work it needs
to
> be in a SQL Table with data in it, I do not think it can be otherwise unle
ss
> its part of a linked server.
> So could you provide some table structure i.e.what it looks like in SQL
> Server tables, and possibly some play data.
> Peter
> "sdane" wrote:
>

No comments:

Post a Comment