Script
<#
.SYNOPSIS
This script can be used to list all attributes of any active directory object.
.DESCRIPTION
This script can be used to list all attributes of any active directory object.
.EXAMPLE
C:\PS> C:\Script\Attributes_of_an_object.ps1 “CN=Administrator,CN=Users,DC=xchange,DC=com”
Lists all attributes of user Administrator.
#>
param([String]$dname)
#Fetches the object for which attributes has to be listed.
$obj = [ADSI](“LDAP://” + “$dname”)
#Fetches a collection of all attributes of the object.
$colObjProps = $obj | get-member
#Lists the attributes one by one.
foreach ($prop in $colObjProps)
{
write-host $prop.Name -nonewline
write-host “: ” -nonewline
write-host $obj.($prop.Name)
}