A
A
Anton Nagaets2020-08-25 13:24:54
PowerShell
Anton Nagaets, 2020-08-25 13:24:54

How to find out which computers are connected to a domain controller?

Good afternoon. The question is both simple and complex:
Without getting up from your chair and without opening unnecessary connections, you need to find out which computers on the network are connected to which CD.
It would be possible to run set logonserver > landisk://%computername%.txt over the network , but I want to get everything on one screen in a small table. such as output (for those who try everything at once in the DC console - this is a Wishlist in PS it is not)

Get-ADComputer -filter * -Properties * | FT Name, LastLogonDate, DC


Or the second option: how to find out which computers are tied as a specific DC?

Maybe someone in their work met modules for PS that will allow you to complete what you are looking for.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
MaxKozlov, 2020-08-25
@MaxKozlov

Well, it’s obvious that it won’t work without extra connections.
The first thing that comes to mind is an analogue of your

Invoke-Command -ComputerName $complist { $Env:LOGONSERVER }

But it's wrong :) and doesn't work - LOGONSERVER is empty with such a connection.
The fact is that computers are not "connected" to the DS, but are authenticated on it. and users too. and LOGONSERVER is about the user
Quick googling suggests a variant with nltest
nltest /sc_query:DOMAIN /server:ComputerName
Where DOMAIN is your domain, and ComputerName can be substituted from AD
There something returns. but it will be necessary to parse a little more.
And again, you can't do without connections :)

S
Sergey Ryzhkin, 2020-08-25
@Franciz

Get-ADComputer -Filter * -Properties *  | Sort LastLogonDate | FT Name, ipv4*, oper*, LastLogonDate -Autosize

Or the second option: how to find out which computers are tied as a specific DC?
All computers in the domain are located in a specific OU, and if you haven’t moved them anywhere, then just try to list those who are in this OU, in this case Computers.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question