Relevance for Windows domain membership

Do you have a favorite method for using relevance according to a PC’s domain membership? After a bit of fudging around I’ve landed on:

exist (matches (regex "foo\.company\.com") of (string values of selects "Domain from Win32_ComputerSystem" of wmi)) is true

or

distinguished name of local computer of active directory contains "DC=foo,DC=company,DC=com"

For the first one, I started with a console property but tacked on the regex match to narrow results. The second is direct from a console property. Suggestions welcome!

There’s also dns domainname of <active directory local computer> that could be used for this kind of thing:

Q: dns domainname of local computer of active directory
A: winterfell.local
2 Likes