Share This Post

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

Share This Post

I am a Microsoft MVP for System Center Configuration Manager and owner of Nackers Consulting Services, LLC. I focus primarily on System Center Configuration Manager and the Microsoft Deployment Toolkit. In addition to helping clients leverage the technologies they use, I enjoy spending a lot of time on the forums and email lists helping answer questions and just seeing what people are doing with the deployment technologies available to them. I have spoken at Microsoft Management Summit on ConfigMgr/MDT integration and I have spoken at user groups around the country. If you have any questions, please feel free to contact me, I am always willing to help.

Leave a Reply