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.


    • Related Articles

    • List Attributes of any Active Directory object

      Most PowerShell scripts available in the internet can help administrators retrieve certain common attributes of an user, group, or a computer. Most scripts either document only specified attributes, or at best only the attributes that have been ...
    • Automating Active Directory user creation

      Creating a single Active Directory (AD) account is a simple task. However, in an organization, the number of AD user accounts an administrator would have to create can rise drastically, making the simple task cumbersome. This is where the process of ...
    • Discovering Active Directory FSMO Role Holders

      FSMO roles play a critical role in the functioning of the Active Directory (AD) environment. Of course, due to the design of these roles, they are distributed among a number of domain controllers in the AD network. This makes it tedious to identify ...
    • How to add/remove Active Directory users to Active Directory groups using PowerShell

      Active Directory is a powerful tool for managing users and groups in a Windows environment. One of the most often-repeated tasks for administrators is to add or remove users from Active Directory groups. In this article, we will explore how to ...
    • How to manage inactive Active Directory user accounts

      Over time, an organization's Active Directory (AD) network can start accumulating inactive user accounts. These accounts can be of employees who may have left the organization, temporary accounts, etc. The problem here is that these inactive AD ...