Get-Aduser why no output?

Welcome Forums General PowerShell Q&A Get-Aduser why no output?

Viewing 3 reply threads
  • Author
    Posts
    • #165160
      Participant
      Topics: 7
      Replies: 9
      Points: 70
      Rank: Member

      Hi Guys,

      I use this script to get some values from some ad users.

      But i know for sure that “company” is filled in can please somebody tell me why this is not filled in my ouput?

       

      $users = Get-Content "C:\temp\users.txt"
      
      $output = Foreach ($user in $users){
          $user = "*" + $user + "*"
          Get-ADUser -Filter {Name -like $user } | Select-Object SamAccountName, Enabled, Company} 
      
      

      OUTPUT:

      SamAccountName Enabled Company
      -------------- ------- -------
      Testuser1 True 
      testuser2 True 
      testuser3 True
    • #165163
      Participant
      Topics: 7
      Replies: 9
      Points: 70
      Rank: Member

      already found the solution -properties * thanks 🙂

    • #165169
      Senior Moderator
      Topics: 9
      Replies: 1236
      Points: 4,443
      Helping Hand
      Rank: Community Hero

      You can specify -Properties Enabled,Company instead of getting all properties using *

    • #165223
      Participant
      Topics: 24
      Replies: 175
      Points: 585
      Helping Hand
      Rank: Major Contributor

      +1 to the only asking for needed properties.

Viewing 3 reply threads
  • The topic ‘Get-Aduser why no output?’ is closed to new replies.