<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Custom Attribute Archives - CarlStanley.com</title>
	<atom:link href="https://carlstanley.com/tag/custom-attribute/feed/" rel="self" type="application/rss+xml" />
	<link>https://carlstanley.com/tag/custom-attribute/</link>
	<description>A resource for Network and Systems Admins</description>
	<lastBuildDate>Fri, 28 May 2021 23:39:53 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>
	<item>
		<title>How to: Create a custom attribute in Active Directory</title>
		<link>https://carlstanley.com/how-to-create-a-custom-attribute-in-active-directory/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=how-to-create-a-custom-attribute-in-active-directory</link>
					<comments>https://carlstanley.com/how-to-create-a-custom-attribute-in-active-directory/#comments</comments>
		
		<dc:creator><![CDATA[Carl]]></dc:creator>
		<pubDate>Fri, 28 May 2021 23:03:32 +0000</pubDate>
				<category><![CDATA[Active Directory]]></category>
		<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[Custom Attribute]]></category>
		<guid isPermaLink="false">https://carlstanley.com/?p=304</guid>

					<description><![CDATA[<p>This article will show you how to create a custom attribute in Active Directory and associate it with the User Class. You must be a Schema Admin to complete these steps. For this example I&#8217;ll show you how to add<span class="ellipsis">&#8230;</span></p>
<div class="read-more"><a href="https://carlstanley.com/how-to-create-a-custom-attribute-in-active-directory/">Read more <span class="screen-reader-text">How to: Create a custom attribute in Active Directory</span><span class="meta-nav"> &#8250;</span></a></div>
<p><!-- end of .read-more --></p>
<p>The post <a href="https://carlstanley.com/how-to-create-a-custom-attribute-in-active-directory/">How to: Create a custom attribute in Active Directory</a> appeared first on <a href="https://carlstanley.com">CarlStanley.com</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>This article will show you how to create a custom attribute in Active Directory and associate it with the User Class.  You must be a Schema Admin to complete these steps. For this example I&#8217;ll show you how to add a Favorite Beer attribute. (Why isn&#8217;t this in there already!)</p>



<p><strong><em>Disclaimer: Editing the AD schema should not be taken lightly. Changes can be irreversible. Do this at your own risk!</em></strong></p>



<span id="more-304"></span>



<h2 class="wp-block-heading">Open the Active Directory Schema</h2>



<p>First, Open the<strong> Schema Management Snap-in</strong>. By default, Microsoft wants to keep you out of the Schema, so you may need to enable it by registering the Schema Management DLL.  To do this, run this command from a command prompt: </p>



<pre class="wp-block-code"><code lang="powershell" class="language-powershell">regsvr32 schmmgmt.dll</code></pre>



<figure class="wp-block-image size-large is-resized"><a href="https://carlstanley.com/wp-content/uploads/2021/05/image-3.png"><img decoding="async" src="https://carlstanley.com/wp-content/uploads/2021/05/image-3.png" alt="" class="wp-image-307" width="370" height="112" srcset="https://carlstanley.com/wp-content/uploads/2021/05/image-3.png 739w, https://carlstanley.com/wp-content/uploads/2021/05/image-3-300x91.png 300w, https://carlstanley.com/wp-content/uploads/2021/05/image-3-100x30.png 100w, https://carlstanley.com/wp-content/uploads/2021/05/image-3-150x45.png 150w, https://carlstanley.com/wp-content/uploads/2021/05/image-3-200x61.png 200w, https://carlstanley.com/wp-content/uploads/2021/05/image-3-450x136.png 450w, https://carlstanley.com/wp-content/uploads/2021/05/image-3-600x182.png 600w" sizes="(max-width: 370px) 100vw, 370px" /></a></figure>



<p>Next, Open MMC and add a new Snap-In.  You&#8217;ll now see &#8220;<strong>Active Directory Schema</strong>&#8221; in the list. Select it, click <strong>add</strong> and click <strong>OK</strong>.</p>



<figure class="wp-block-image size-large is-resized"><a href="https://carlstanley.com/wp-content/uploads/2021/05/image-4.png"><img fetchpriority="high" decoding="async" src="https://carlstanley.com/wp-content/uploads/2021/05/image-4-1024x720.png" alt="" class="wp-image-309" width="512" height="360" srcset="https://carlstanley.com/wp-content/uploads/2021/05/image-4-1024x720.png 1024w, https://carlstanley.com/wp-content/uploads/2021/05/image-4-300x211.png 300w, https://carlstanley.com/wp-content/uploads/2021/05/image-4-768x540.png 768w, https://carlstanley.com/wp-content/uploads/2021/05/image-4-100x70.png 100w, https://carlstanley.com/wp-content/uploads/2021/05/image-4-150x105.png 150w, https://carlstanley.com/wp-content/uploads/2021/05/image-4-200x141.png 200w, https://carlstanley.com/wp-content/uploads/2021/05/image-4-450x316.png 450w, https://carlstanley.com/wp-content/uploads/2021/05/image-4-600x422.png 600w, https://carlstanley.com/wp-content/uploads/2021/05/image-4-900x633.png 900w, https://carlstanley.com/wp-content/uploads/2021/05/image-4.png 1374w" sizes="(max-width: 512px) 100vw, 512px" /></a></figure>



<p></p>



<h2 class="wp-block-heading">Create the Custom Attribute</h2>



<p>Expand <strong>Active Directory Schema</strong>, Right click on <strong>Attributes</strong> and click <strong>Create Attribute</strong></p>



<figure class="wp-block-image size-large is-resized"><a href="https://carlstanley.com/wp-content/uploads/2021/05/image-5.png"><img decoding="async" src="https://carlstanley.com/wp-content/uploads/2021/05/image-5.png" alt="Active Directory Custom Attribute" class="wp-image-310" width="326" height="216" srcset="https://carlstanley.com/wp-content/uploads/2021/05/image-5.png 651w, https://carlstanley.com/wp-content/uploads/2021/05/image-5-300x199.png 300w, https://carlstanley.com/wp-content/uploads/2021/05/image-5-100x66.png 100w, https://carlstanley.com/wp-content/uploads/2021/05/image-5-150x100.png 150w, https://carlstanley.com/wp-content/uploads/2021/05/image-5-200x133.png 200w, https://carlstanley.com/wp-content/uploads/2021/05/image-5-450x299.png 450w, https://carlstanley.com/wp-content/uploads/2021/05/image-5-600x398.png 600w" sizes="(max-width: 326px) 100vw, 326px" /></a></figure>



<p>You will get a warning instructing you of the dangers of modifying the schema. If you are ready to proceed, click <strong>Continue</strong>.</p>



<figure class="wp-block-image size-large is-resized"><a href="https://carlstanley.com/wp-content/uploads/2021/05/image-7.png"><img loading="lazy" decoding="async" src="https://carlstanley.com/wp-content/uploads/2021/05/image-7.png" alt="" class="wp-image-312" width="366" height="159" srcset="https://carlstanley.com/wp-content/uploads/2021/05/image-7.png 732w, https://carlstanley.com/wp-content/uploads/2021/05/image-7-300x130.png 300w, https://carlstanley.com/wp-content/uploads/2021/05/image-7-100x43.png 100w, https://carlstanley.com/wp-content/uploads/2021/05/image-7-150x65.png 150w, https://carlstanley.com/wp-content/uploads/2021/05/image-7-200x87.png 200w, https://carlstanley.com/wp-content/uploads/2021/05/image-7-450x195.png 450w, https://carlstanley.com/wp-content/uploads/2021/05/image-7-600x261.png 600w" sizes="auto, (max-width: 366px) 100vw, 366px" /></a></figure>



<p>The <strong>Create New Attribute</strong> form will appear. Enter the name of the custom attribute in the <strong>Common Name</strong> field. In my case, it&#8217;s FavoriteBeer. Avoid special characters and spaces.</p>



<p>The <strong>LDAP Display Name </strong>should automatically be created with first letter lowercase. (This follows the camelCase like standard for most of other attributes)  Modify it if needed, but it&#8217;s probably best left alone.</p>



<p>The <strong>Unique X500 Object ID</strong> requires a little extra work. (Why don&#8217;t they just have a &#8220;generate OID&#8221; button).  We have to generate our own unique OID. This OID must be in the correct format and must also contain the correct prefix.  To make this easy, <strong>open up a PowerShell window</strong> and <strong>copy\paste the following commands</strong> (Tip: You can paste the whole block at once):</p>



<pre class="wp-block-code"><code lang="powershell" class="language-powershell"> $Prefix="1.2.840.113556.1.8000.2554"&nbsp;
 $GUID=[System.Guid]::NewGuid().ToString()&nbsp;
 $Parts=@()&nbsp;
 $Parts+=[UInt64]::Parse($guid.SubString(0,4),"AllowHexSpecifier")&nbsp;
 $Parts+=[UInt64]::Parse($guid.SubString(4,4),"AllowHexSpecifier")&nbsp;
 $Parts+=[UInt64]::Parse($guid.SubString(9,4),"AllowHexSpecifier")&nbsp;
 $Parts+=[UInt64]::Parse($guid.SubString(14,4),"AllowHexSpecifier")&nbsp;
 $Parts+=[UInt64]::Parse($guid.SubString(19,4),"AllowHexSpecifier")&nbsp;
 $Parts+=[UInt64]::Parse($guid.SubString(24,6),"AllowHexSpecifier")&nbsp;
 $Parts+=[UInt64]::Parse($guid.SubString(30,6),"AllowHexSpecifier")&nbsp;
 $OID=[String]::Format("{0}.{1}.{2}.{3}.{4}.{5}.{6}.{7}",$prefix,$Parts[0],$Parts[1],$Parts[2],$Parts[3],$Parts[4],$Parts[5],$Parts[6])&nbsp;
 $oid
</code></pre>



<p>Here is an example of what this looks like.  The OID is the highlighted text below.  Copy and paste this in the <strong>X500 Object ID </strong>field. This is example output. <strong>Do not</strong> use the same OID that I got. Run the commands to get your own.</p>



<div class="wp-block-image"><figure class="alignleft size-large"><a href="https://carlstanley.com/wp-content/uploads/2021/05/image-9.png"><img loading="lazy" decoding="async" width="1024" height="262" src="https://carlstanley.com/wp-content/uploads/2021/05/image-9-1024x262.png" alt="" class="wp-image-317" srcset="https://carlstanley.com/wp-content/uploads/2021/05/image-9-1024x262.png 1024w, https://carlstanley.com/wp-content/uploads/2021/05/image-9-300x77.png 300w, https://carlstanley.com/wp-content/uploads/2021/05/image-9-768x197.png 768w, https://carlstanley.com/wp-content/uploads/2021/05/image-9-1536x394.png 1536w, https://carlstanley.com/wp-content/uploads/2021/05/image-9-2048x525.png 2048w, https://carlstanley.com/wp-content/uploads/2021/05/image-9-100x26.png 100w, https://carlstanley.com/wp-content/uploads/2021/05/image-9-150x38.png 150w, https://carlstanley.com/wp-content/uploads/2021/05/image-9-200x51.png 200w, https://carlstanley.com/wp-content/uploads/2021/05/image-9-450x115.png 450w, https://carlstanley.com/wp-content/uploads/2021/05/image-9-600x154.png 600w, https://carlstanley.com/wp-content/uploads/2021/05/image-9-900x231.png 900w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></a></figure></div>



<p>Feel free to give your new attribute a useful <strong>Description</strong>. </p>



<p>Next is <strong>Syntax</strong>.  This is the data type of your new attribute. Since I need to store names of drinks that may contain letters and numbers, I selected Unicode String for alpha-numeric data. I left the Minimum and Maximum range blank. Here&#8217;s what mine looks like:</p>



<figure class="wp-block-image size-large is-resized"><a href="https://carlstanley.com/wp-content/uploads/2021/05/image-12.png"><img loading="lazy" decoding="async" src="https://carlstanley.com/wp-content/uploads/2021/05/image-12.png" alt="Active Directory Custom Attribute" class="wp-image-322" width="393" height="418" srcset="https://carlstanley.com/wp-content/uploads/2021/05/image-12.png 786w, https://carlstanley.com/wp-content/uploads/2021/05/image-12-282x300.png 282w, https://carlstanley.com/wp-content/uploads/2021/05/image-12-768x817.png 768w, https://carlstanley.com/wp-content/uploads/2021/05/image-12-100x106.png 100w, https://carlstanley.com/wp-content/uploads/2021/05/image-12-150x160.png 150w, https://carlstanley.com/wp-content/uploads/2021/05/image-12-200x213.png 200w, https://carlstanley.com/wp-content/uploads/2021/05/image-12-300x319.png 300w, https://carlstanley.com/wp-content/uploads/2021/05/image-12-450x479.png 450w, https://carlstanley.com/wp-content/uploads/2021/05/image-12-600x638.png 600w" sizes="auto, (max-width: 393px) 100vw, 393px" /></a><figcaption>Again don&#8217;t use the same OID as me.  Generate your own.</figcaption></figure>



<p>When finished, <strong>double check everything </strong>(Remember this can&#8217;t be undone). Then <strong>click OK</strong>. </p>



<p>You have now created a new Active Directory Custom Attribute. Next step is to bind it to the User Class.</p>



<p></p>



<h2 class="wp-block-heading">Bind the Attribute to the the User Class</h2>



<p>To do this, <strong>Click on Classes</strong>, then find and double click on the <strong>User Class</strong>:</p>



<figure class="wp-block-image size-large is-resized"><a href="https://carlstanley.com/wp-content/uploads/2021/05/image-13.png"><img loading="lazy" decoding="async" src="https://carlstanley.com/wp-content/uploads/2021/05/image-13-1024x497.png" alt="" class="wp-image-326" width="621" height="302" srcset="https://carlstanley.com/wp-content/uploads/2021/05/image-13-1024x497.png 1024w, https://carlstanley.com/wp-content/uploads/2021/05/image-13-300x146.png 300w, https://carlstanley.com/wp-content/uploads/2021/05/image-13-768x372.png 768w, https://carlstanley.com/wp-content/uploads/2021/05/image-13-1536x745.png 1536w, https://carlstanley.com/wp-content/uploads/2021/05/image-13-100x49.png 100w, https://carlstanley.com/wp-content/uploads/2021/05/image-13-150x73.png 150w, https://carlstanley.com/wp-content/uploads/2021/05/image-13-200x97.png 200w, https://carlstanley.com/wp-content/uploads/2021/05/image-13-450x218.png 450w, https://carlstanley.com/wp-content/uploads/2021/05/image-13-600x291.png 600w, https://carlstanley.com/wp-content/uploads/2021/05/image-13-900x437.png 900w, https://carlstanley.com/wp-content/uploads/2021/05/image-13.png 1668w" sizes="auto, (max-width: 621px) 100vw, 621px" /></a></figure>



<p>Click the <strong>Attributes tab</strong>, then click <strong>Add</strong> and find your new attribute and click <strong>OK</strong>. Your attribute will be added to the Optional attributes.  Click <strong>OK</strong> to save and close the User Class Properties.</p>



<figure class="wp-block-image size-large is-resized"><a href="https://carlstanley.com/wp-content/uploads/2021/05/image-14.png"><img loading="lazy" decoding="async" src="https://carlstanley.com/wp-content/uploads/2021/05/image-14-1024x618.png" alt="Active Directory Custom Attribute" class="wp-image-327" width="768" height="464" srcset="https://carlstanley.com/wp-content/uploads/2021/05/image-14-1024x618.png 1024w, https://carlstanley.com/wp-content/uploads/2021/05/image-14-300x181.png 300w, https://carlstanley.com/wp-content/uploads/2021/05/image-14-768x464.png 768w, https://carlstanley.com/wp-content/uploads/2021/05/image-14-1536x927.png 1536w, https://carlstanley.com/wp-content/uploads/2021/05/image-14-100x60.png 100w, https://carlstanley.com/wp-content/uploads/2021/05/image-14-150x91.png 150w, https://carlstanley.com/wp-content/uploads/2021/05/image-14-200x121.png 200w, https://carlstanley.com/wp-content/uploads/2021/05/image-14-450x272.png 450w, https://carlstanley.com/wp-content/uploads/2021/05/image-14-600x362.png 600w, https://carlstanley.com/wp-content/uploads/2021/05/image-14-900x543.png 900w, https://carlstanley.com/wp-content/uploads/2021/05/image-14.png 1602w" sizes="auto, (max-width: 768px) 100vw, 768px" /></a></figure>



<p>That&#8217;s it.  You can close the Schema Management snap-in.</p>



<p></p>



<h2 class="wp-block-heading">Test it</h2>



<p>You can now modify this like any other user attribute.  Open Active Directory Users and Computers (with Advanced Features enabled) and go to the Attribute Editor tab.</p>



<figure class="wp-block-image size-large is-resized"><a href="https://carlstanley.com/wp-content/uploads/2021/05/image-15.png"><img loading="lazy" decoding="async" src="https://carlstanley.com/wp-content/uploads/2021/05/image-15-771x1024.png" alt="Active Directory Custom Attribute" class="wp-image-328" width="386" height="512" srcset="https://carlstanley.com/wp-content/uploads/2021/05/image-15-771x1024.png 771w, https://carlstanley.com/wp-content/uploads/2021/05/image-15-226x300.png 226w, https://carlstanley.com/wp-content/uploads/2021/05/image-15-768x1020.png 768w, https://carlstanley.com/wp-content/uploads/2021/05/image-15-100x133.png 100w, https://carlstanley.com/wp-content/uploads/2021/05/image-15-150x199.png 150w, https://carlstanley.com/wp-content/uploads/2021/05/image-15-200x266.png 200w, https://carlstanley.com/wp-content/uploads/2021/05/image-15-300x398.png 300w, https://carlstanley.com/wp-content/uploads/2021/05/image-15-450x598.png 450w, https://carlstanley.com/wp-content/uploads/2021/05/image-15-600x797.png 600w, https://carlstanley.com/wp-content/uploads/2021/05/image-15.png 848w" sizes="auto, (max-width: 386px) 100vw, 386px" /></a></figure>



<p>You can also query and set this new custom attribute via PowerShell:</p>



<figure class="wp-block-image size-large"><a href="https://carlstanley.com/wp-content/uploads/2021/05/image-16.png"><img loading="lazy" decoding="async" width="1024" height="381" src="https://carlstanley.com/wp-content/uploads/2021/05/image-16-1024x381.png" alt="" class="wp-image-329" srcset="https://carlstanley.com/wp-content/uploads/2021/05/image-16-1024x381.png 1024w, https://carlstanley.com/wp-content/uploads/2021/05/image-16-300x112.png 300w, https://carlstanley.com/wp-content/uploads/2021/05/image-16-768x286.png 768w, https://carlstanley.com/wp-content/uploads/2021/05/image-16-1536x571.png 1536w, https://carlstanley.com/wp-content/uploads/2021/05/image-16-100x37.png 100w, https://carlstanley.com/wp-content/uploads/2021/05/image-16-150x56.png 150w, https://carlstanley.com/wp-content/uploads/2021/05/image-16-200x74.png 200w, https://carlstanley.com/wp-content/uploads/2021/05/image-16-450x167.png 450w, https://carlstanley.com/wp-content/uploads/2021/05/image-16-600x223.png 600w, https://carlstanley.com/wp-content/uploads/2021/05/image-16-900x335.png 900w, https://carlstanley.com/wp-content/uploads/2021/05/image-16.png 1570w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></a><figcaption><em>I should have named this attribute FavoriteDrink</em></figcaption></figure>



<p></p>



<p>-Carl</p>
<p>The post <a href="https://carlstanley.com/how-to-create-a-custom-attribute-in-active-directory/">How to: Create a custom attribute in Active Directory</a> appeared first on <a href="https://carlstanley.com">CarlStanley.com</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://carlstanley.com/how-to-create-a-custom-attribute-in-active-directory/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
			</item>
	</channel>
</rss>
