Custom property: based on computer's active directory distinguishedname

Hello,
I would like to have a new property on all my computers in my organization.
This property should give an output based on specific string in Active Directory distinguishedname (AD DN).

I would like to get my computer DN and give it a value in the new property base on the string located in it’s AD DN.
for example, If my computer’s AD DN is “CN=SRV1,OU=DBATEAM,DC=contoso,DC=com” then the output should be “DBA”, else if AD DN is “CN=SRV1,OU=NETTEAM,DC=contoso,DC=com” then “Networking”.

Thank you guys

Does something like this do what you’re after?

(if it contains "ou=dbateam,dc=contoso,dc=com" then "DBA" else if it contains "ou=netteam,dc=contoso,dc=com" then "NETTEAM" else nothing) of (distinguished name of local computer of active directory as lowercase)