Active Directory relevance: how to append "contains OU=X,OU=Y,DC=MY"

(imported topic written by intrepdmind91)

Our company has a decentralized IT, with a very complicated AD structure. I’m trying to develop relevance of XP Service Pack Driver # in relation to a specific branch of AD, so that we can update computers where necessary. The following works well (and is what we are trying to query):

Q: if (name of operating system = “WinXP”) then value “FileVersion” of version block of file “C:\Windows\system32\HAL.DLL” else if (name of operating system contains “Vista”) then “not applicable” else if (name of operating system contains “Mac OS”) then “not applicable” else “unknown”

A: 5.1.2600.5512 (xpsp.080413-2111)

But I’d like to append this to it, so that I’m not querying the entire AD structure, but rather, a specific branch:

contains OU=X,OU=Y,OU=Z,DC=MY,DC=COMPANY

This is probably simple, but I’m not grasping it. Any thoughts? Thank you in advance.

(imported comment written by intrepdmind91)

Figured it out:

if distinguished name of local computer of active directory contains “OU=X,OU=Y,DC=MY,DC=COMPANY” AND yadda yadda yadda