Sometimes you would need to have a list of all the computers joined to the domain in your infrastructure. Instead of going through all the Organizational Units (OUs) in your AD infrastructure and listing all the computers, you can easily use the below Powershell Script.
CLS
Import-Module ActiveDirectory
$ComputerName = get-ADComputer -Filter * | Select -Expand Name
Foreach ($CN in $ComputerName)
{ write-host $CN}
This will type a list of all the computers joined in your AD infrastructure. Save it to a file with extension PS1 and run it. If you would like to save the output to file simply run the file by adding > filename.txt
and replace the write-host
with write-output
(587)