[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 562
  • Last Modified:

powershell question - quest commandlets

need some assistance with a script.

The objective is to scan all accounts [new hires] for a particular value in the "custom attribute" fields [fields 1 - 10]

and based on that value, add the new accounts to the appropriate groups in AD.

should be pretty easy to do, here is the script i have that keys on the "title" value, just need to modify this to key on the "custom attribute" value instead.

get-qaduser | where ($_.title -eq <targetvalue>) | foreach {add-qadgroupmember <groupname>}

thx in advance.

  • 2
1 Solution
Krzysztof PytkoActive Directory EngineerCommented:
Try this way
Get-QADUser -LDAPFilter '(customAttributeName=$_.value)'

Open in new window

siber1Author Commented:
Krzysztof, this doesnt seem to work either, although i am not seeing any errors, but the security group membership does not change.
siber1Author Commented:
thanks this works fine.

Featured Post

Problems using Powershell and Active Directory?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now