Get-Aduser -filter

Welcome Forums General PowerShell Q&A Get-Aduser -filter

This topic contains 4 replies, has 3 voices, and was last updated by

 
Participant
1 year, 10 months ago.

  • Author
    Posts
  • #61929

    Participant
    Points: 0
    Rank: Member

    Hello,

    I want to search AD using the displayprintablename due to our tracking system. I can export a CSV to include their full name, POBox, ticket number. I have to use ANR and the problem with that is if I have 50 John Doe's I need to filter based on their POBox.

    I want to run this report everyday so if a person is no longer in AD, we can close their ticket. I have this code and it works perfectly, I *think* I just need to add another -and statement but my brain can't come up with the solution

    $arraylist = Import-Csv '\\nw145757\Projects\QuerySnow.csv'
    $arraylist | % {
    Get-ADUser -filter "anr -eq '$($_.RequestedFor)'" -Properties * | select displaynamePrintable, DisplayName, POBox, samAccountName, mail
    } | ft

    Cheers!

  • #61930

    Keymaster
    Points: 1,673
    Helping HandTeam Member
    Rank: Community Hero

    "anr -eq '$($_.RequestedFor)' -and something -eq something"

    ?

    • #61965

      Participant
      Points: 0
      Rank: Member

      that was it. I'm not sure how I missed this but I appreciate it!

  • #62035

    Participant
    Points: 21
    Rank: Member
  • #62061

    Participant
    Points: 0
    Rank: Member

    It's not but I have a feeling I know who that is

The topic ‘Get-Aduser -filter’ is closed to new replies.