I am kind of new to programming but it looks interesting as i want to make an script for my WMI filter.

i want to use a WMI filter to look into the department field and if there is a user with department field set to sales than he should get"policy 1"
and if the user is in production than the user should get "policy 2"
but i just can not figure out where i can get the object from department field
can some one help me on the way?