Creating a custom object in Active Directory

Creating a custom object in Active Directory

There may be instances where the objects available in an Active Directory (AD) schema do not suit your organization's requirements. In this case, you can create a custom AD object that suits your organization's needs. This task can be done easily using PowerShell. Creating a custom object in AD using PowerShell is a two-part process.

First,  create an AD object. Then, define the properties of the object. The following script is used to create a custom object of the type: System.Management.Automation.PSCustomObject.
 
  1. $object = New-Object –TypeName PSObject
 
Once the object is created, you can use the following script to define its properties. The following script will define the object's Member property.
 
  1. $object | Add-Member –MemberType NoteProperty –Name MyProperty –Value SomeValue
 
This way, you can keep adding properties to the object as necessary.