show all enabled computers in specific OUs

PS C:\Windows\system32> Get-ADComputer -SearchBase ‘OU=Computers,OU=Location,OU=company,DC=company,DC=com’ -Filter “Enabled -eq ‘$true'” | Select -Exp Name > C:\ListofPCs.txt; Get-ADComputer -Searchbase ‘OU=Servers,OU=Location,OU=company,DC=company,DC=com’ -Filter “Enabled -eq ‘$true'” | Select -Exp Name >> C:\ListofPCs.txt

Leave a Reply

Your email address will not be published. Required fields are marked *