Get-ADComputer: List Windows Servers that are enabled only

Raul Chiarella 21 Reputation points
2022-03-01T21:14:47.61+00:00

Hello everyone!
I know the following command that lists Windows Servers

Get-ADComputer -Filter { OperatingSystem -Like 'Windows Server'}

But i want to show enabled Servers only... How do i use two filters in the same command?
I know this seems a very newbie question but i'm newbie on Powershell, so... :|

Thanks in advance!

Active Directory
Active Directory
A set of directory-based technologies included in Windows Server.
6,579 questions
Windows Server PowerShell
Windows Server PowerShell
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.PowerShell: A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
5,537 questions
0 comments No comments
{count} votes

Accepted answer
  1. Rich Matheisen 46,796 Reputation points
    2022-03-01T22:10:25.4+00:00

    Combine them with an '-and' operator:

    Get-ADComputer -Filter "OperatingSystem -Like '*Windows Server*' -and Enabled -eq 'True'"
    
    1 person found this answer helpful.
    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.