SCCM SQL Query : Get User Information From A Specified OU

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
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s