<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="https://www.w3.org/2005/Atom" xmlns:sy="https://purl.org/rss/1.0/modules/syndication/" xmlns:dc="https://purl.org/dc/elements/1.1/" xmlns:content="https://purl.org/rss/1.0/modules/content/" xmlns:wfw="https://wellformedweb.org/CommentAPI/" xmlns:slash="https://purl.org/rss/1.0/modules/slash/"
  version="2.0">
  <channel>
    <title>-Author $ShirleyM</title>
    <atom:link
      href="https://docs.microsoft.com/archive/blogs/blur-lines_-powershell_-author_shirleym/feed.xml"
      rel="self"
      type="application/rss+xml" />
    <link>https://docs.microsoft.com/archive/blogs/blur-lines_-powershell_-author_shirleym/feed.xml</link>
    <description />
    <lastBuildDate>Wed, 17 Apr 2019 03:23:06 GMT</lastBuildDate>
    <language>en-US</language>
    <sy:updatePeriod>hourly</sy:updatePeriod>
    <sy:updateFrequency>1</sy:updateFrequency>
    <item>
      <title>Manager can update membership list Part 3</title>
      <link>https://docs.microsoft.com/archive/blogs/blur-lines_-powershell_-author_shirleym/manager-can-update-membership-list-part-3</link>
      <pubDate>Thu, 24 Oct 2013 15:44:00 GMT</pubDate>
      <dc:creator><![CDATA[shirl9141]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.technet.microsoft.com/blur-lines_-powershell_-author_shirleym/2013/10/24/manager-can-update-membership-list-part-3/</guid>
      <description><![CDATA[In the first post, we looked at the script to allow a manager of an AD group to update the...]]></description>
      <content:encoded><![CDATA[<p><span style="font-family: arial,helvetica,sans-serif;">In the <a href="https://blogs.technet.com/b/blur-lines_-powershell_-author_shirleym/archive/2013/10/07/manager-can-update-membership-list.aspxfirst post">first post</a>, we looked at the script to allow a manager of an AD group to update the membership list. The&nbsp;<a href="https://blogs.technet.com/b/blur-lines_-powershell_-author_shirleym/archive/2013/10/23/manager-can-update-membership-list-part-2.aspx">second post</a> demonstrated how to retrieve the guid for the extended rights to apply this right. <span style="font-size: x-small;">Now</span> we will look at how to determine what rights are&nbsp;needed&nbsp;for updating a membership list in an AD group.</span></p>
<p><span style="font-family: arial,helvetica,sans-serif;">The script below is setting up the&nbsp;AD&nbsp;group for specific rights.</span></p>
<p><span style="font-size: x-small;"><span style="color: #ff4500; font-family: Lucida Console;"><span style="color: #ff4500; font-family: Lucida Console;"><span style="color: #ff4500; font-family: Lucida Console;">$ctrl</span></span></span><span style="color: #a9a9a9; font-family: Lucida Console;"><span style="color: #a9a9a9; font-family: Lucida Console;"><span style="color: #a9a9a9; font-family: Lucida Console;">=</span></span></span><span style="color: #a9a9a9; font-family: Lucida Console;"><span style="color: #a9a9a9; font-family: Lucida Console;"><span style="color: #a9a9a9; font-family: Lucida Console;">[</span></span></span><span style="color: #008080; font-family: Lucida Console;"><span style="color: #008080; font-family: Lucida Console;"><span style="color: #008080; font-family: Lucida Console;">System.Security.AccessControl.AccessControlType</span></span></span><span style="color: #a9a9a9; font-family: Lucida Console;"><span style="color: #a9a9a9; font-family: Lucida Console;"><span style="color: #a9a9a9; font-family: Lucida Console;">]::</span></span></span><span style="font-family: Lucida Console;"><span style="font-family: Lucida Console;">Allow</span></span><span style="font-family: Lucida Console;"><span style="font-family: Lucida Console;"></span></span></span></p>
<p><span style="font-size: x-small;"><span style="color: #a9a9a9; font-family: Lucida Console;"><span style="color: #a9a9a9; font-family: Lucida Console;"><span style="color: #a9a9a9; font-family: Lucida Console;"><span style="color: #ff4500; font-family: Lucida Console;"><span style="color: #ff4500; font-family: Lucida Console;"><span style="color: #ff4500; font-family: Lucida Console;">$rights</span></span></span>=</span></span></span><span style="color: #a9a9a9; font-family: Lucida Console;"><span style="color: #a9a9a9; font-family: Lucida Console;"><span style="color: #a9a9a9; font-family: Lucida Console;">[</span></span></span><span style="color: #008080; font-family: Lucida Console;"><span style="color: #008080; font-family: Lucida Console;"><span style="color: #008080; font-family: Lucida Console;">System.DirectoryServices.ActiveDirectoryRights</span></span></span><span style="color: #a9a9a9; font-family: Lucida Console;"><span style="color: #a9a9a9; font-family: Lucida Console;"><span style="color: #a9a9a9; font-family: Lucida Console;">]::</span></span></span><span style="font-family: Lucida Console;"><span style="font-family: Lucida Console;">WriteProperty </span></span><span style="color: #a9a9a9; font-family: Lucida Console;"><span style="color: #a9a9a9; font-family: Lucida Console;"><span style="color: #a9a9a9; font-family: Lucida Console;">-bor</span></span></span><span style="color: #a9a9a9; font-family: Lucida Console;"><span style="color: #a9a9a9; font-family: Lucida Console;"><span style="color: #a9a9a9; font-family: Lucida Console;">[</span></span></span><span style="color: #008080; font-family: Lucida Console;"><span style="color: #008080; font-family: Lucida Console;"><span style="color: #008080; font-family: Lucida Console;">System.DirectoryServices.ActiveDirectoryRights</span></span></span><span style="color: #a9a9a9; font-family: Lucida Console;"><span style="color: #a9a9a9; font-family: Lucida Console;"><span style="color: #a9a9a9; font-family: Lucida Console;">]::</span></span></span><span style="font-family: Lucida Console;"><span style="font-family: Lucida Console;">ExtendedRight</span></span></span></p>
<p><span style="font-size: x-small;"><span style="color: #a9a9a9; font-family: Lucida Console;"><span style="color: #a9a9a9; font-family: Lucida Console;"><span style="color: #a9a9a9; font-family: Lucida Console;"><span style="color: #ff4500; font-family: Lucida Console;"><span style="color: #ff4500; font-family: Lucida Console;"><span style="color: #ff4500; font-family: Lucida Console;">$intype</span></span></span>=</span></span></span><span style="color: #a9a9a9; font-family: Lucida Console;"><span style="color: #a9a9a9; font-family: Lucida Console;"><span style="color: #a9a9a9; font-family: Lucida Console;">[</span></span></span><span style="color: #008080; font-family: Lucida Console;"><span style="color: #008080; font-family: Lucida Console;"><span style="color: #008080; font-family: Lucida Console;">System.DirectoryServices.ActiveDirectorySecurityInheritance</span></span></span><span style="color: #a9a9a9; font-family: Lucida Console;"><span style="color: #a9a9a9; font-family: Lucida Console;"><span style="color: #a9a9a9; font-family: Lucida Console;">]::</span></span></span><span style="font-family: Lucida Console;"><span style="font-family: Lucida Console;">None </span></span></span></p>
<p>&nbsp;</p>
<p><span style="font-family: arial,helvetica,sans-serif;">Of course, we can go through documentation to determine the rights, but who has time to go through documentation. Why don't we just give the user permissions to manage the list, then look at the rights given? Then take away those rights by clearing the permissions manually through the gui. </span></p>
<p><span style="font-size: small;"><span style="font-family: Lucida Console;"><span style="font-family: Lucida Console;"><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/00/61/4621.Capture.JPG" original-url="https://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-00-61/4621.Capture.JPG"><img src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/00/61/4621.Capture.JPG" original-url="https://blogs.technet.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-00-61/4621.Capture.JPG" alt="" width="350" height="125" border="0" /></a></span></span></span></p>
<p>&nbsp;</p>
<p><span style="font-family: arial,helvetica,sans-serif;">Toggle&nbsp;these permissions, then look at the difference by executing the following command.</span></p>
<p><span style="font-size: small;"><span style="font-family: Lucida Console;"><span style="font-family: Lucida Console;"><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/00/61/3618.Capture.JPG" original-url="https://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-00-61/3618.Capture.JPG"><img src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/00/61/3618.Capture.JPG" original-url="https://blogs.technet.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-00-61/3618.Capture.JPG" alt="" border="0" /></a>&nbsp;</span></span></span></p>
<p><span style="font-family: arial,helvetica,sans-serif;">Now we are able to determine what flags and rights&nbsp;to set&nbsp;for the AD group object. Next we need to add this AD rule to the current ACL.&nbsp;Create the new rule by using&nbsp;the .NET class, System.DirectoryServices.ActiveDirectoryAccessRule. Look at the constructor on <a href="https://msdn.microsoft.com/en-us/library/xh02bekw.aspx">MSDN</a> to determine what parameters are required. </span></p>
<p><span style="font-family: arial,helvetica,sans-serif;">Create the new access rule, add the new rule, and then set the acl with the new rule. </span></p>
<p>&nbsp;</p>
<p><span style="font-size: x-small;"><span style="color: #ff4500; font-family: Lucida Console;"><span style="color: #ff4500; font-family: Lucida Console;"><span style="color: #ff4500; font-family: Lucida Console;">$acl</span></span></span><span style="color: #a9a9a9; font-family: Lucida Console;"><span style="color: #a9a9a9; font-family: Lucida Console;"><span style="color: #a9a9a9; font-family: Lucida Console;">=</span></span></span><span style="color: #0000ff; font-family: Lucida Console;"><span style="color: #0000ff; font-family: Lucida Console;"><span style="color: #0000ff; font-family: Lucida Console;">Get-Acl </span></span></span><span style="color: #8a2be2; font-family: Lucida Console;"><span style="color: #8a2be2; font-family: Lucida Console;"><span style="color: #8a2be2; font-family: Lucida Console;">ad:"cn=testgroup,cn=users,dc=contoso,dc=com" </span></span></span></span></p>
<p><span style="font-size: x-small;"><span style="color: #ff4500; font-family: Lucida Console;"><span style="color: #ff4500; font-family: Lucida Console;"><span style="color: #ff4500; font-family: Lucida Console;">$rule</span></span></span><span style="color: #a9a9a9; font-family: Lucida Console;"><span style="color: #a9a9a9; font-family: Lucida Console;"><span style="color: #a9a9a9; font-family: Lucida Console;">=</span></span></span><span style="color: #0000ff; font-family: Lucida Console;"><span style="color: #0000ff; font-family: Lucida Console;"><span style="color: #0000ff; font-family: Lucida Console;">New-Object</span></span></span><span style="color: #8a2be2; font-family: Lucida Console;"><span style="color: #8a2be2; font-family: Lucida Console;"><span style="color: #8a2be2; font-family: Lucida Console;">System.DirectoryServices.ActiveDirectoryAccessRule</span></span></span><span style="font-family: Lucida Console;"><span style="font-family: Lucida Console;">(</span></span><span style="color: #ff4500; font-family: Lucida Console;"><span style="color: #ff4500; font-family: Lucida Console;"><span style="color: #ff4500; font-family: Lucida Console;">$sid</span></span></span><span style="color: #a9a9a9; font-family: Lucida Console;"><span style="color: #a9a9a9; font-family: Lucida Console;"><span style="color: #a9a9a9; font-family: Lucida Console;">,</span></span></span><span style="color: #ff4500; font-family: Lucida Console;"><span style="color: #ff4500; font-family: Lucida Console;"><span style="color: #ff4500; font-family: Lucida Console;">$rights</span></span></span><span style="color: #a9a9a9; font-family: Lucida Console;"><span style="color: #a9a9a9; font-family: Lucida Console;"><span style="color: #a9a9a9; font-family: Lucida Console;">,</span></span></span><span style="color: #ff4500; font-family: Lucida Console;"><span style="color: #ff4500; font-family: Lucida Console;"><span style="color: #ff4500; font-family: Lucida Console;">$ctrl</span></span></span><span style="color: #a9a9a9; font-family: Lucida Console;"><span style="color: #a9a9a9; font-family: Lucida Console;"><span style="color: #a9a9a9; font-family: Lucida Console;">,</span></span></span><span style="color: #ff4500; font-family: Lucida Console;"><span style="color: #ff4500; font-family: Lucida Console;"><span style="color: #ff4500; font-family: Lucida Console;">$guid</span></span></span><span style="font-family: Lucida Console;"><span style="font-family: Lucida Console;">)</span></span></span></p>
<p><span style="font-size: x-small;"><span style="color: #ff4500; font-family: Lucida Console;"><span style="color: #ff4500; font-family: Lucida Console;"><span style="color: #ff4500; font-family: Lucida Console;">$acl</span></span></span><span style="color: #a9a9a9; font-family: Lucida Console;"><span style="color: #a9a9a9; font-family: Lucida Console;"><span style="color: #a9a9a9; font-family: Lucida Console;">.</span></span></span><span style="font-family: Lucida Console;"><span style="font-family: Lucida Console;">AddAccessRule(</span></span><span style="color: #ff4500; font-family: Lucida Console;"><span style="color: #ff4500; font-family: Lucida Console;"><span style="color: #ff4500; font-family: Lucida Console;">$rule</span></span></span><span style="font-family: Lucida Console;"><span style="font-family: Lucida Console;">) </span></span></span></p>
<p><span style="font-size: x-small;"><span style="color: #0000ff; font-family: Lucida Console;"><span style="color: #0000ff; font-family: Lucida Console;"><span style="color: #0000ff; font-family: Lucida Console;">Set-Acl </span></span></span><span style="color: #ff4500; font-family: Lucida Console;"><span style="color: #ff4500; font-family: Lucida Console;"><span style="color: #ff4500; font-family: Lucida Console;">$acl </span></span></span><span style="color: #000080; font-family: Lucida Console;"><span style="color: #000080; font-family: Lucida Console;"><span style="color: #000080; font-family: Lucida Console;">-path </span></span></span><span style="color: #8a2be2; font-family: Lucida Console;"><span style="color: #8a2be2; font-family: Lucida Console;"><span style="color: #8a2be2; font-family: Lucida Console;">ad:"cn=testgroup,cn=users,dc=contoso,dc=com" </span></span></span></span></p>
<p>&nbsp;</p>
<p><span style="font-family: arial,helvetica,sans-serif;">Voila! We have checked the checkbox. The manager of the group now has permission&nbsp;to update the membership list.</span></p>
<p>&nbsp;</p>]]></content:encoded>
    </item>
    <item>
      <title>Manager can update membership list Part 2</title>
      <link>https://docs.microsoft.com/archive/blogs/blur-lines_-powershell_-author_shirleym/manager-can-update-membership-list-part-2</link>
      <pubDate>Wed, 23 Oct 2013 18:30:00 GMT</pubDate>
      <dc:creator><![CDATA[shirl9141]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.technet.microsoft.com/blur-lines_-powershell_-author_shirleym/2013/10/23/manager-can-update-membership-list-part-2/</guid>
      <description><![CDATA[There are 3 posts to this topic. This post demonstrates howto find the guid for the script, which...]]></description>
      <content:encoded><![CDATA[<p>There are 3 posts to this topic. This post demonstrates how<br />to find the guid for the <a title="script" href="https://blogs.technet.com/b/blur-lines_-powershell_-author_shirleym/archive/2013/10/07/manager-can-update-membership-list.aspx">script</a>, which permits a user to manage a group&rsquo;s<br />membership list. &nbsp;The goal is to automate<br />the task of giving a user permissions to manage a group without having admin<br />rights. The manager of the list can remove/add users without being a domain<br />admin.</p>
<p>First we need to find the guid that will give the manager of<br />the group these extend rights. Once, we have this guid, then we can apply this<br />guid to the AD group.</p>
<p><span style="color: #999999;">What is the guid and how do we find this guid?</span></p>
<p>We need to find the Global Unique Identifier for<br />the Self Membership extended right.</p>
<p>&nbsp;</p>
<p>Open ADSI Edit</p>
<p>Right-Click ADSI Edit and select Connect To</p>
<p><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/00/61/7026.adsi1.jpg" original-url="https://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-00-61/7026.adsi1.jpg"><img src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/00/61/7026.adsi1.jpg" original-url="https://blogs.technet.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-00-61/7026.adsi1.jpg" alt="" width="341" height="399" border="0" /></a><br />&nbsp;</p>
<p>Connect to Configuration</p>
<p>Select CN=Configuration and then CN=Extended-Rights</p>
<p>&nbsp;</p>
<p>Open CN=Self-Membership</p>
<p>Find the guid under rightsGuid</p>
<p><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/00/61/8512.adsi3.jpg" original-url="https://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-00-61/8512.adsi3.jpg"><img src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/00/61/8512.adsi3.jpg" original-url="https://blogs.technet.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-00-61/8512.adsi3.jpg" alt="" width="363" height="387" border="0" /></a></p>
<p>Now we can apply this guid to the AD Access Rule on the AD<br />object, which will be explained in the next <a href="https://blogs.technet.com/b/blur-lines_-powershell_-author_shirleym/archive/2013/10/23/manager-can-update-membership-list-part-2.aspx">post</a>. In the next post we will look at the rights and how to determine&nbsp; the rights.</p>]]></content:encoded>
    </item>
    <item>
      <title>Manager can update membership list Part 1</title>
      <link>https://docs.microsoft.com/archive/blogs/blur-lines_-powershell_-author_shirleym/manager-can-update-membership-list-part-1</link>
      <pubDate>Mon, 07 Oct 2013 20:23:00 GMT</pubDate>
      <dc:creator><![CDATA[shirl9141]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.technet.microsoft.com/blur-lines_-powershell_-author_shirleym/2013/10/07/manager-can-update-membership-list-part-1/</guid>
      <description><![CDATA[Sometimes trying to automate something simple as selecting a checkbox is no simple task. This is the...]]></description>
      <content:encoded><![CDATA[<p>Sometimes trying to automate something simple as selecting a checkbox is no simple task. This is the first part of a series of posts on how to select the 'Manager can update membership list' checkbox for an AD group&nbsp;in PowerShell.&nbsp;The first&nbsp;part&nbsp;will give you the PowerShell script that will automate this process. The continuation of this post will go over the script in more detail and show you the steps that led up to this solution.</p>
<p>&nbsp;</p>
<p>Below is the GUI used to select the user to manage the group and whether that user is allowed to&nbsp;update the membership list. Setting the manger is the easy part, but selecting the checkbox can be a little more complicated.</p>
<p>&nbsp;</p>
<p><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/00/61/5226.Capture.JPG" original-url="https://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-00-61/5226.Capture.JPG"><img src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/00/61/5226.Capture.JPG" original-url="https://blogs.technet.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-00-61/5226.Capture.JPG" alt="" width="334" height="226" border="0" /></a>&nbsp;</p>
<p>&nbsp;</p>
<p>The script&nbsp;below will&nbsp;set the user as the&nbsp;manager and allow them to update the membership list. There will be more to come in the&nbsp;next posts to look at the script in&nbsp;fine detail.</p>
<p>&nbsp;</p>
<p><span style="color: #339966;">&lt;#</span></p>
<p><span style="color: #339966;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; look at adsi-edit for this guid</span></p>
<p><span style="color: #339966;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Configuration -&gt; Extended Rights -&gt; Self-Membership</span></p>
<p><span style="color: #339966;">&nbsp;&nbsp;&nbsp;&nbsp; Open Self-Membership and the guid will be under rightsGuid</span></p>
<p><span style="color: #339966;">#&gt;</span></p>
<p>$guid <span style="color: #a9a9a9; font-family: Lucida Console;"><span style="color: #a9a9a9; font-family: Lucida Console;">=</span></span><span style="color: #a9a9a9; font-family: Lucida Console;"><span style="color: #a9a9a9; font-family: Lucida Console;">[</span></span><span style="color: #008080; font-family: Lucida Console;"><span style="color: #008080; font-family: Lucida Console;">guid</span></span><span style="color: #a9a9a9; font-family: Lucida Console;"><span style="color: #a9a9a9; font-family: Lucida Console;">]</span></span><span style="color: #8b0000; font-family: Lucida Console;"><span style="color: #8b0000; font-family: Lucida Console;">'bf9679c0-0de6-11d0-a285-00aa003049e2'</span></span></p>
<p>$user <span style="color: #a9a9a9; font-family: Lucida Console;"><span style="color: #a9a9a9; font-family: Lucida Console;">= </span></span><span style="color: #0000ff; font-family: Lucida Console;"><span style="color: #0000ff; font-family: Lucida Console;">New-Object </span></span><span style="color: #8a2be2; font-family: Lucida Console;"><span style="color: #8a2be2; font-family: Lucida Console;">System.Security.Principal.NTAccount</span></span><span style="font-family: Lucida Console;">(</span><span style="color: #8b0000; font-family: Lucida Console;"><span style="color: #8b0000; font-family: Lucida Console;">"contoso\jsmith"</span></span><span style="font-family: Lucida Console;">)</span></p>
<p><span style="font-family: Lucida Console;"><br /></span></p>
<p>$sid <span style="color: #a9a9a9; font-family: Lucida Console;"><span style="color: #a9a9a9; font-family: Lucida Console;">=</span></span><span style="color: #ff4500; font-family: Lucida Console;"><span style="color: #ff4500; font-family: Lucida Console;">$user</span></span><span style="color: #a9a9a9; font-family: Lucida Console;"><span style="color: #a9a9a9; font-family: Lucida Console;">.</span></span><span style="font-family: Lucida Console;">translate(</span><span style="color: #a9a9a9; font-family: Lucida Console;"><span style="color: #a9a9a9; font-family: Lucida Console;">[</span></span><span style="color: #008080; font-family: Lucida Console;"><span style="color: #008080; font-family: Lucida Console;">System.Security.Principal.SecurityIdentifier</span></span><span style="color: #a9a9a9; font-family: Lucida Console;"><span style="color: #a9a9a9; font-family: Lucida Console;">]</span></span><span style="font-family: Lucida Console;">)</span></p>
<p>$acl <span style="color: #999999;">=</span> <span style="color: #0000ff; font-family: Lucida Console;"><span style="color: #0000ff; font-family: Lucida Console;">Get-Acl </span></span><span style="color: #8a2be2; font-family: Lucida Console;"><span style="color: #8a2be2; font-family: Lucida Console;">ad:"cn=testgroup,cn=users,dc=contoso,dc=com"</span></span></p>
<p><span style="color: #8a2be2; font-family: Lucida Console;"><span style="color: #8a2be2; font-family: Lucida Console;"><br /></span></span></p>
<p>$ctrl <span style="color: #a9a9a9; font-family: Lucida Console;"><span style="color: #a9a9a9; font-family: Lucida Console;">=</span></span><span style="color: #a9a9a9; font-family: Lucida Console;"><span style="color: #a9a9a9; font-family: Lucida Console;">[</span></span><span style="color: #008080; font-family: Lucida Console;"><span style="color: #008080; font-family: Lucida Console;">System.Security.AccessControl.AccessControlType</span></span><span style="color: #a9a9a9; font-family: Lucida Console;"><span style="color: #a9a9a9; font-family: Lucida Console;">]::</span></span><span style="font-family: Lucida Console;">Allow</span></p>
<p>$rights <span style="color: #a9a9a9; font-family: Lucida Console;"><span style="color: #a9a9a9; font-family: Lucida Console;">=</span></span><span style="color: #a9a9a9; font-family: Lucida Console;"><span style="color: #a9a9a9; font-family: Lucida Console;">[</span></span><span style="color: #008080; font-family: Lucida Console;"><span style="color: #008080; font-family: Lucida Console;">System.DirectoryServices.ActiveDirectoryRights</span></span><span style="color: #a9a9a9; font-family: Lucida Console;"><span style="color: #a9a9a9; font-family: Lucida Console;">]::</span></span><span style="font-family: Lucida Console;">WriteProperty </span><span style="color: #a9a9a9; font-family: Lucida Console;"><span style="color: #a9a9a9; font-family: Lucida Console;">-bor</span></span><span style="color: #a9a9a9; font-family: Lucida Console;"><span style="color: #a9a9a9; font-family: Lucida Console;">[</span></span><span style="color: #008080; font-family: Lucida Console;"><span style="color: #008080; font-family: Lucida Console;">System.DirectoryServices.ActiveDirectoryRights</span></span><span style="color: #a9a9a9; font-family: Lucida Console;"><span style="color: #a9a9a9; font-family: Lucida Console;">]::</span></span><span style="font-family: Lucida Console;">ExtendedRight</span></p>
<p>$intype <span style="color: #a9a9a9; font-family: Lucida Console;"><span style="color: #a9a9a9; font-family: Lucida Console;">=</span></span><span style="color: #a9a9a9; font-family: Lucida Console;"><span style="color: #a9a9a9; font-family: Lucida Console;">[</span></span><span style="color: #008080; font-family: Lucida Console;"><span style="color: #008080; font-family: Lucida Console;">System.DirectoryServices.ActiveDirectorySecurityInheritance</span></span><span style="color: #a9a9a9; font-family: Lucida Console;"><span style="color: #a9a9a9; font-family: Lucida Console;">]::</span></span><span style="font-family: Lucida Console;">None</span></p>
<p>&nbsp;</p>
<p><span style="color: #339966;">#set the ManagedBy property</span></p>
<p>$group <span style="color: #a9a9a9; font-family: Lucida Console;"><span style="color: #a9a9a9; font-family: Lucida Console;">=</span></span><span style="color: #a9a9a9; font-family: Lucida Console;"><span style="color: #a9a9a9; font-family: Lucida Console;">[</span></span><span style="color: #008080; font-family: Lucida Console;"><span style="color: #008080; font-family: Lucida Console;">adsi</span></span><span style="color: #a9a9a9; font-family: Lucida Console;"><span style="color: #a9a9a9; font-family: Lucida Console;">]</span></span><span style="color: #8b0000; font-family: Lucida Console;"><span style="color: #8b0000; font-family: Lucida Console;">'LDAP://cn=testgroup,cn=users,dc=contoso,dc=com'</span></span></p>
<p>$group<span style="color: #a9a9a9; font-family: Lucida Console;"><span style="color: #a9a9a9; font-family: Lucida Console;">.</span></span><span style="font-family: Lucida Console;">put(</span><span style="color: #8b0000; font-family: Lucida Console;"><span style="color: #8b0000; font-family: Lucida Console;">"ManagedBy"</span></span><span style="color: #a9a9a9; font-family: Lucida Console;"><span style="color: #a9a9a9; font-family: Lucida Console;">,</span></span><span style="color: #8b0000; font-family: Lucida Console;"><span style="color: #8b0000; font-family: Lucida Console;">"CN=jillsmith,OU=TestOU,DC=Contoso,DC=COM"</span></span><span style="font-family: Lucida Console;">)</span></p>
<p>$group.<span style="font-family: Lucida Console;">setinfo()</span></p>
<p>&nbsp;</p>
<p><span style="color: #339966;">#create the new rule and add the rule<br /></span><span style="color: #339966;"># https://msdn.microsoft.com/en-us/library/xh02bekw.aspx</span></p>
<p>$rule = <span style="color: #0000ff; font-family: Lucida Console;"><span style="color: #0000ff; font-family: Lucida Console;">New-Object </span></span><span style="color: #8a2be2; font-family: Lucida Console;"><span style="color: #8a2be2; font-family: Lucida Console;">System.DirectoryServices.ActiveDirectoryAccessRule</span></span><span style="font-family: Lucida Console;">(</span><span style="color: #ff4500; font-family: Lucida Console;"><span style="color: #ff4500; font-family: Lucida Console;">$sid</span></span><span style="color: #a9a9a9; font-family: Lucida Console;"><span style="color: #a9a9a9; font-family: Lucida Console;">,</span></span><span style="color: #ff4500; font-family: Lucida Console;"><span style="color: #ff4500; font-family: Lucida Console;">$rights</span></span><span style="color: #a9a9a9; font-family: Lucida Console;"><span style="color: #a9a9a9; font-family: Lucida Console;">,</span></span><span style="color: #ff4500; font-family: Lucida Console;"><span style="color: #ff4500; font-family: Lucida Console;">$ctrl</span></span><span style="color: #a9a9a9; font-family: Lucida Console;"><span style="color: #a9a9a9; font-family: Lucida Console;">,</span></span><span style="color: #ff4500; font-family: Lucida Console;"><span style="color: #ff4500; font-family: Lucida Console;">$guid</span></span><span style="font-family: Lucida Console;">)</span></p>
<p><span style="color: #ff4500; font-family: Lucida Console;"><span style="color: #ff4500; font-family: Lucida Console;">$acl</span></span><span style="color: #a9a9a9; font-family: Lucida Console;"><span style="color: #a9a9a9; font-family: Lucida Console;">.</span></span><span style="font-family: Lucida Console;">AddAccessRule(</span><span style="color: #ff4500; font-family: Lucida Console;"><span style="color: #ff4500; font-family: Lucida Console;">$rule</span></span><span style="font-family: Lucida Console;">)</span></p>
<p><span style="color: #0000ff; font-family: Lucida Console;"><span style="color: #0000ff; font-family: Lucida Console;">Set-Acl </span></span>-acl <span style="color: #ff4500; font-family: Lucida Console;"><span style="color: #ff4500; font-family: Lucida Console;">$acl </span></span><span style="color: #000080; font-family: Lucida Console;"><span style="color: #000080; font-family: Lucida Console;">-path </span></span><span style="color: #8a2be2; font-family: Lucida Console;"><span style="color: #8a2be2; font-family: Lucida Console;">ad:"cn=testgroup,cn=users,dc=contoso,dc=com"</span></span></p>
<p><span style="color: #8a2be2; font-family: Lucida Console;"><span style="color: #8a2be2; font-family: Lucida Console;"><br /></span></span><span style="color: #0000ff;">Write-Host</span> "Voila! We have the checkbox checked"</p>
<p>&nbsp;</p>
<hr style="width: 50%;" width="50%" />
<p>The next post will explain how to obtain the guid for the Self Member extended right.</p>
<p>&nbsp;<a title="Part 2: The Extended Rights Guid" href="https://blogs.technet.com/b/blur-lines_-powershell_-author_shirleym/archive/2013/10/23/manager-can-update-membership-list-part-2.aspx">Part 2</a></p>
<p>&nbsp;</p>]]></content:encoded>
    </item>
  </channel>
</rss>