Get-aduser with email emailaddress field

Welcome Forums General PowerShell Q&A Get-aduser with email emailaddress field

Viewing 2 reply threads
  • Author
    Posts
    • #6332
      Participant
      Topics: 1562
      Replies: 0
      Points: 1
      Rank: Member

      by Christopher.Ellis at 2013-04-26 10:07:43

      I want to run a quick powershell script which reports all users names in our active directory with empty emailaddress field
      I would start the command with get-aduser however the rest not known to me. List produced would be username Populate and emailaddress would be empty.
      Thank you

      by Christopher.Ellis at 2013-04-26 10:24:46

      get-aduser -property ’emailaddress’ | select-object -property name, emailaddress

      I got this far, however if I wanted to state emailaddress = empty display name the above command gets all accounts

      by Martin9700 at 2013-04-26 10:30:03

      Kind of a goofy one, evidently Get-ADuser doesn’t recognize the $null variable within a filter but I found this to work:

      Get-ADUser -Filter {EmailAddress -notlike "*"} -Properties EmailAddress | Select Name

      by Christopher.Ellis at 2013-04-26 10:41:29

      Thank you

    • #30321
      Participant
      Topics: 0
      Replies: 1
      Points: 0
      Rank: Member

      Instead of the ‘-notlike “*”‘ you could use ‘-le 0’

      • #80641
        Participant
        Topics: 0
        Replies: 1
        Points: 0
        Rank: Member

        I needed to do this too, but I needed a list of all the email addresses. I ended up using this:

    • #80732
      Naw
      Participant
      Topics: 4
      Replies: 45
      Points: 94
      Rank: Member

      Hi Chris

      Just run the command below, you will get all AD account with no an email address assigned.

      I have tested it so this will work 🙂

Viewing 2 reply threads
  • The topic ‘Get-aduser with email emailaddress field’ is closed to new replies.