Sunday, May 18, 2014

SQL user Information From A Specified OU

SQL :


Select Distinct

CS.Name0 'Machine Name',

CS.UserName0 'User Name',

RU.Full_User_Name0 'Full Name',

UOU.User_OU_Name0 'Users OU',

RA.IP_Subnets0  'Subnet'

From v_Gs_Computer_System CS

Join v_RA_System_IPSubnets RA on RA.ResourceID = CS.ResourceID

Join v_R_User RU on RU.Unique_User_Name0 = CS.UserName0

Join v_RA_User_UserOUName UOU on UOU.ResourceID = RU.ResourceID

Where UOU.User_OU_Name0 = 'DomainName.COM/OuName'

Order by  CS.Name0, CS.Username0, RU.Full_User_Name0, RA.IP_Subnets0

No comments:

Post a Comment