List enabled and disabled Active Directory computer objects

List enabled and disabled Active Directory computer objects

You can list the Active Directory computer accounts and check their status (enabled or disabled objects) in different ways.

  • First method with the Get-ADComputer cmdlet

    Script (with Microsoft Active Directory module loaded : import-module activedirectory) :
    Only disabled computer accounts

    Only enabled computer accounts

  • Second method with the Search-ADAccount cmdlet

    Script (with Microsoft Active Directory module loaded : import-module activedirectory) :
    Only disabled computer accounts

  • Third method with the Get-ADObject cmdlet

    Only disabled computer accounts

    Only enabled computer accounts


<>

Reference

Get-ADComputer
Syntax

  • Filter
  • ResultPageSize
  • ResultSetSize
  • SearchBase
  • SearchScope
  • AuthType
  • Credential
  • Partition
  • Properties
  • Server

  • Identity
  • AuthType
  • Credential
  • Partition
  • Properties
  • Server

  • LDAPFilter
  • ResultPageSize
  • ResultSetSize
  • SearchBase
  • SearchScope
  • AuthType
  • Credential
  • Partition
  • Properties
  • Server

Detailed Description
The Get-ADComputer cmdlet gets a computer or performs a search to retrieve multiple computers.

The Identity parameter specifies the Active Directory computer to retrieve. You can identify a computer by its distinguished name (DN), GUID, security identifier (SID) or Security Accounts Manager (SAM) account name. You can also set the parameter to a computer object variable, such as $ or pass a computer object through the pipeline to the Identity parameter.

To search for and retrieve more than one computer, use the Filter or LDAPFilter parameters. The Filter parameter uses the PowerShell Expression Language to write query strings for Active Directory. PowerShell Expression Language syntax provides rich type conversion support for value types received by the Filter parameter. For more information about the Filter parameter syntax, see about_ActiveDirectory_Filter. If you have existing LDAP query strings, you can use the LDAPFilter parameter.

This cmdlet retrieves a default set of computer object properties. To retrieve additional properties use the Properties parameter. For more information about the how to determine the properties for computer objects, see the Properties parameter description.

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Social Media Auto Publish Powered By : XYZScripts.com
%d bloggers like this: