Computer properties from Get-adcomputer

This topic contains 6 replies, has 4 voices, and was last updated by  edwin arlington 2 weeks ago.

  • Author
    Posts
  • #83023

    Chandra
    Participant

    Hello all,

    New to this forum

    I need to find out properties of particular computers in my domain.

    Get-Adcomputer "computername" -properties * | select-object Name -> giving me the output for selected computer. Is there any way I can get properties of particular computers(for example 10 different computers) in one command.

    Kindly help.

    Thank you

  • #83026

    Don Jones
    Keymaster

    "computer1","computer2","computer3" | Get-ADComputer -Properties *

    I'll note that there's no point in "-properties *" if you're only going to Select-Object the Name property.

    • #83036

      Chandra
      Participant

      thank you Don, Appreciate it. I need details of IP address and canonical name, thats the reason I used select object.

      Can I use the same command when I am searching in different domains ? The command I am trying is

      "computer1","computer2","computer3" | Get-ADComputer -SearchBase "dc=mydomain,dc=net" -Server "mydomain.net" -Properties * |select-object name, ipv4address, canonicalname

  • #83039

    Don Jones
    Keymaster

    In theory, yes, although it depends on how authentication is set up across them. It's usually easier to map a new AD drive to the target domain, change to that drive, and then run the command. The drive provides an authenticated context.

    • #83045

      Chandra
      Participant

      Thank you. I am still a beginner, so i am not sure how to change to different domain.

      When I run the above command, it give me message saying:

      cmdlet Get-ADcomputer at command pipeline position 1
      supply values for the following parameters
      (Type!? for help.)
      FIlter:

  • #83122

    postanote
    Participant

    That is because you are passing in a list of computers, and not the Get-ADComputer cmdlet which one to use and what to do with
    them.

    You have to tell it the computer identity (name) and write a loop to go thru the list.

    "computer1","computer2","computer3" |
    % { Get-ADComputer -Identity $_ }

    Since you are passing a list that $_, at is simplest level, is shorthand for use the item from the list.

    See the Get-ADComputer help and the ForLoop help for more details.

  • #83654

    edwin arlington
    Participant

    You can try the following script which creates a txt file with the complete list.

    $strCategory = "computer"
    $objDomain = New-Object System.DirectoryServices.DirectoryEntry("LDAP://OU=OUName,dc=DOMAIN,dc=com")
    $objSearcher = New-Object System.DirectoryServices.DirectorySearcher($objDomain,"(objectCategory=$strCategory)",@('name'))
    $objSearcher.FindAll() | %{$_.properties.name} | out-file C:\computers.txt

You must be logged in to reply to this topic.