Author Posts

October 26, 2017 at 6:32 pm

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

October 26, 2017 at 6:34 pm

"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.

October 26, 2017 at 6:59 pm

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

October 26, 2017 at 7:01 pm

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.

October 26, 2017 at 7:13 pm

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:

October 27, 2017 at 5:39 pm

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.

November 6, 2017 at 10:47 am

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