Get-ADComputer -Filter | Syntax Examples - Easy365Manager

Skip to content Get-ADComputer with Filter parameter

The PowerShell command Get-ADComputer is part of the Active Directory PowerShell module. Go to this article if you want to know how to install it.

To search effectively for computers in your Active Directory you should use the Filter switch. Don’t extract all computers and then search the result set.

Use Get-ADComputer -Filter to search directly for improved performance.

Understand the Get-ADComputer Filter Parameter

With the many various filtering options available (LDAP filtering, oData v3.0 filtering, etc.) the filter switch often causes some confusion.

The filter switch used in the Get-ADComputer command uses the PowerShell expression language in the query string.

This is different than e.g. when using the Get-AzureADUser command (which uses oData v3.0 filtering)!

The following operators should cover most of your needs:

OperatorMeaningSample expression
-eqEqual toName -eq “WKS-2021”
-neNot equal toOperatingSystemVersion -ne “10.0 (14393)”
-gtGreater thanLastLogonTimestamp -gt $date
-geGreater than or equalCreated -ge “01-01-2018”
-ltLess thanModified -lt “01-02-2021”
-leLess than or equalCreated -le “01-01-2018”
-likeWildcard searchOperatingSystem -like “*2008*”
-notlikeWildcard search with negationOperatingSystem -notlike “*2016*”
-andAndOperatingSystem -like “*Server*” -and operatingSystemServicePack -eq “Service Pack 1”
-orOrOperatingSystem -like “*2008*” -or OperatingSystem -like “*2016*”

Please notice the following in the above examples:

  • Enclose the compared value(s) in apostrophes
  • Use -like ‘*’ and -notlike ‘*’ to find empty or non-empty values 
  • Filter “cryptic” date/time formats directly with a DateTime variable (like e.g. the LastLogonTimeStamp attribute which uses the FileTime format)

Below you have some code snippets that should point you in the right direction on how to structure your filters for your Get-ADComputer search queries:

Get-ADComputer -Filter 'Name -eq "WKS-2021"' Get-ADComputer -Filter 'OperatingSystemVersion -ne "10.0 (14393)"' $Date = (Get-Date).AddDays(-60) Get-ADComputer -Filter 'lastLogonTimestamp -gt $date' Get-ADComputer -Filter 'Modified -ge "06-04-2021 12:00:00"' $Date = (Get-Date).AddDays(-60) Get-ADComputer -Filter 'lastLogonTimestamp -lt $date' Get-ADComputer -Filter 'Created -le "01-01-2020"' Get-ADComputer -Filter 'OperatingSystem -like "*2008*"' Get-ADComputer -Filter 'OperatingSystem -notlike "*2016*"' Get-ADComputer -Filter 'OperatingSystem -like "*Server*" -and operatingSystemServicePack -eq "Service Pack 1"' Get-ADComputer -Filter 'OperatingSystem -like "*2008*" -or OperatingSystem -like "*2016*"'

Why Struggle With PowerShell in the First Place?

If you’re still using Active Directory Users & Computers (ADUC) for day-to-day management, it’s time for an upgrade. EasyEntra is a free, modernized replacement that takes everything you wish ADUC could do – and makes it a reality.

Here’s how EasyEntra supercharges searching and filtering:

  • Instant search results as you typeNo more waiting or hitting “Enter.” EasyEntra returns live search results instantly, even in large environments.

  • 🔍 Full support for LDAP queriesPower users can leverage complex LDAP filters, and EasyEntra evaluates them in real time as you type – perfect for testing queries quickly.

  • 📝 Relaxed typed queries for everyday useNo need to memorize LDAP syntax for common tasks. Simply type queries like:

    • disabled=true to find disabled accounts

    • lockedout=true to locate locked-out users

    • lastlogon<2025-01-01 to filter by operating system

It’s intuitive and flexible, ideal for both junior IT staff and seasoned administrators.

On top of this, you can easily customize the properties included in the search result and export all data to a .csv file. No more escalation to senior IT when a quick insight into AD is needed.

And the best part? EasyEntra is completely free – forever – for pure AD management and for hybrid and cloud-only environments with up to 25 licensed users.

EasyEntra installs in under a minute, requires no servers or service accounts, and works side by side with your existing tools.

Turbo-charge your first-line support now by downloading the 30-day trial.

“One of the best products I’ve used.” – CIO, Mirick Law, United States

“We really love working with EasyEntra.” – Head of IT, IKN GmbH, Germany

“It feels almost like a revolution.” – IT Manager, Arjeplog Kommun, Sweden

EasyEntra mimics the layout of AD Users & Computers to ensure easy adoption within your helpdesk. But it does so much more:

  • Management of cloud group membership.
  • Management of Microsoft 365 licenses.
  • Management of all Exchange Online mailbox settings.
  • Management of cloud-only objects.
  • Easy automation of user onboarding/offboarding in an easy-to-follow script-less procedure.
  • Single-click synchronization of Azure AD Connect.
  • Copy/paste group membership and mailbox permissions.
  • Uses standard OAuth2 authentication with full support for MFA, PIM, and FIDO2 access keys.
  • 10-second installation and 20-second configuration.
  • Installs on Windows 10/11 or Windows Server 2019 or later.
  • No server/service/service account is needed.
  • No trust in third-party cloud applications is needed.
  • Extensive documentation for easy Helpdesk handover.

With EasyEntra, you can literally cut 50-75% of the cost of Microsoft 365 management in a few minutes.

Sounds too good to be true? Download the 30-day trial and experience EasyEntra firsthand.

Search for: Easy365Manager Easy365Manager is the missing link between on-premises and Office 365. Martin DugganTechnology Infrastructure LeadCornerstone, United Kingdom
Office 365 Plugin forActive Directory Users & Computers
Easy365Manager has saved us tons of time. Matt BryantIT Systems AdministratorAudioscan, Canada
Delegate calendar permissions without PowerShell
Easy365Manager is a real time saver! Very well thought out software. Manny MamakasSenior ConsultantGreenwire Solutions, United States
MANAGE MEETING ROOMS AND ROOM LISTS WITH EASE
Saves us time that we can use on our many other projects waiting to be done. Devin GrayDirector of Information Technology & CommunicationCity of Edwardsville, United States
Manage email attributes without on-premises Exchange Server
Easy365Manager installation and Exchange removal was conducted smoothly and rapidly. Support provided by Easy365Manager team is efficient and fast. Eric GaillardIT & Facilities Addex Therapeutics, Switzerland
Install and Configure in Less Than Two Minutes
Removing my old Exchange server is a game changer! What a great time-saver to manage Office 365 and AD on one dashboard! ChristopherSaint Agnes School, United States
Manage Office 365 licenses and mailboxes from AD Users & Computers
Love this tool! Works and does everything we need! Matt WeberSystems AdministratorCommunity Bridges, United States
CONFIGURE OUTLOOK AUTOMAPPING WITHOUT POWERSHELL
Great product, I'm really happy we found it! Charles-Eric HachéHead of IT and TelecommunicationCity of Sainte-Julie, Canada
VIEW AND CONFIGURE AUTO-REPLY SCHEDULES WITHOUT POWERSHELL
We love using Easy365Manager. The program makes everything a lot more enjoyable for us. Bram BorkinkSystems AdministratorLinthorst Techniek, Netherlands
MULTI-OBJECT EDITING OF EXCHANGE ONLINE MAILBOXES
Easy365Manager really took care of a lot of security concerns by being able to turn off our last Exchange Server and simultaneously being able to handle Exchange Online completely in AD, without opening the browser. Marcus OddoSystems AdministratorCodac, United States
Single-click Azure AD Connect synchronization
Aside from Easy365Manager being such a revolutionary tool, your level of expertise in your product and responsiveness to our questions has made us very eager to partner with you. Jerry JacobsenSupv. of Network AdminMetal-Tek, United States

Tag » Active Directory Get Computer Operating System