Adding User’s OU to query

SELECT  distinct
CS.Name0 as ‘NetBIOS’,
CS.UserName0 as ‘UserID’,
RU.Full_User_Name0 as ‘Full Name’,
UOU.User_OU_Name0 as ‘Users OU’,
RA.IP_Subnets0 as ‘Subnet’
from
dbo.v_GS_COMPUTER_SYSTEM CS 
FULL join dbo.v_RA_System_IPSubnets RA on RA.ResourceID = CS.ResourceID
FULL join dbo.v_R_User RU on RU.Unique_User_Name0 = CS.UserName0
FULL join dbo.v_RA_User_UserOUName UOU on UOU.ResourceID = RU.ResourceID
Order by 
CS.Name0,  
CS.Username0, 
RU.Full_User_Name0,
RA.IP_Subnets0

Leave a Reply

Your email address will not be published. Required fields are marked *