Chris Nackers Blog

ConfigMgr and MDT Deployment Solutions

Useful Blogs

User Groups

Finding the OU of a system in SMS/ConfigMgr

Alex Semibratov started up a blog and has a nice post on how to find the actual OU of a computer.  If you have ever looked at the information you will notice you get a lot more than you might be looking for. 

I tested this with SMS 2003 and it works since the same view can be used.  You will want to replace the “SMS_ENT” with your database name however.

Linked here:

http://blogs.msdn.com/alex_semi/archive/2009/07/29/direct-ou-in-sccm.aspx

Here is the basic query if you don’t want to create a new view for it:

 

SELECT     A.ResourceID, A.System_OU_Name0

FROM        dbo.v_RA_System_SystemOUName AS A INNER JOIN

(SELECT    ResourceID, MAX(LEN(System_OU_Name0)) AS len

FROM         dbo.v_RA_System_SystemOUName

GROUP BY ResourceID) AS B ON A.ResourceID= B.ResourceID AND LEN(A.System_OU_Name0) = B.len

 

Here is another query by Casey Robertson that works as well:

 

SELECT ResourceID, MAX(System_OU_Name0)

FROM [database].dbo.v_RA_System_SystemOUName

GROUP BY ResourceID

 

 

Hope this helps,

Chris

Comments

No Comments