Get-Aduser why no output?

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

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

 
Participant
2 months, 1 week ago.

  • 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: 8
    Replies: 1041
    Points: 3,439
    Helping Hand
    Rank: Community Hero

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

  • #165223

    Participant
    Topics: 23
    Replies: 154
    Points: 368
    Helping Hand
    Rank: Contributor

    +1 to the only asking for needed properties.

You must be logged in to reply to this topic.