{"id":52443,"date":"2009-09-17T03:01:00","date_gmt":"2009-09-17T03:01:00","guid":{"rendered":"https:\/\/blogs.technet.microsoft.com\/heyscriptingguy\/2009\/09\/17\/hey-scripting-guy-can-i-remove-specific-folder-access-rights-on-a-per-user-basis\/"},"modified":"2009-09-17T03:01:00","modified_gmt":"2009-09-17T03:01:00","slug":"hey-scripting-guy-can-i-remove-specific-folder-access-rights-on-a-per-user-basis","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/scripting\/hey-scripting-guy-can-i-remove-specific-folder-access-rights-on-a-per-user-basis\/","title":{"rendered":"Hey, Scripting Guy! Can I Remove Specific Folder Access Rights on a Per-User Basis?"},"content":{"rendered":"<p><SPAN class=\"sbmLink\">\n<TABLE cellSpacing=\"1\" cellPadding=\"1\">\n<TBODY>\n<TR>\n<TD class=\"sbmText\">Share this post: <\/TD>\n<TD><A title=\"Post it to Backflip!\" href=\"http:\/\/www.backflip.com\/add_page_pop.ihtml?url=http:\/\/blogs.technet.com\/heyscriptingguy\/archive\/2009\/09\/17\/hey-scripting-guy-september-17-2009.aspx&amp;title=Hey,%20Scripting%20Guy!%20Can%20I%20Remove%20Specific%20Folder%20Access%20Rights%20on%20a%20Per-User%20Basis?\" target=\"_blank\"><IMG border=\"0\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/backflip4.png\"><\/A><\/TD>\n<TD><A title=\"Post it to Buddymark!\" href=\"http:\/\/buddymarks.com\/s_add_bookmark.php?bookmark_url=http:\/\/blogs.technet.com\/heyscriptingguy\/archive\/2009\/09\/17\/hey-scripting-guy-september-17-2009.aspx&amp;bookmark_title=Hey,%20Scripting%20Guy!%20Can%20I%20Remove%20Specific%20Folder%20Access%20Rights%20on%20a%20Per-User%20Basis?\" target=\"_blank\"><IMG border=\"0\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/buddymar4.png\"><\/A><\/TD>\n<TD><A title=\"Post it to Del.icio.us!\" href=\"http:\/\/del.icio.us\/post?url=http:\/\/blogs.technet.com\/heyscriptingguy\/archive\/2009\/09\/17\/hey-scripting-guy-september-17-2009.aspx&amp;;title=Hey,%20Scripting%20Guy!%20Can%20I%20Remove%20Specific%20Folder%20Access%20Rights%20on%20a%20Per-User%20Basis?\" target=\"_blank\"><IMG border=\"0\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/deliciou4.png\"><\/A><\/TD>\n<TD><A title=\"Post it to Digg!\" href=\"http:\/\/digg.com\/submit?phase=2&amp;url=http:\/\/blogs.technet.com\/heyscriptingguy\/archive\/2009\/09\/17\/hey-scripting-guy-september-17-2009.aspx&amp;title=Hey,%20Scripting%20Guy!%20Can%20I%20Remove%20Specific%20Folder%20Access%20Rights%20on%20a%20Per-User%20Basis?\" target=\"_blank\"><IMG border=\"0\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/digg14.png\"><\/A><\/TD>\n<TD><A title=\"Post it to Facebook!\" href=\"http:\/\/www.facebook.com\/sharer.php?u=http:\/\/blogs.technet.com\/heyscriptingguy\/archive\/2009\/09\/17\/hey-scripting-guy-september-17-2009.aspx&amp;t=Hey,%20Scripting%20Guy!%20Can%20I%20Remove%20Specific%20Folder%20Access%20Rights%20on%20a%20Per-User%20Basis?\" target=\"_blank\"><IMG border=\"0\" src=\"https:\/\/msdnshared.blob.core.windows.net\/media\/TNBlogsFS\/prod.evol.blogs.technet.com\/telligent.evolution.components.attachments\/13\/4982\/00\/00\/01\/76\/53\/19\/facebook.JPG\"><\/A><\/TD>\n<TD><A title=\"Post it to Furl!\" href=\"http:\/\/www.furl.net\/store?s=f&amp;to=0&amp;u=http:\/\/blogs.technet.com\/heyscriptingguy\/archive\/2009\/09\/17\/hey-scripting-guy-september-17-2009.aspx&amp;ti=Hey,%20Scripting%20Guy!%20Can%20I%20Remove%20Specific%20Folder%20Access%20Rights%20on%20a%20Per-User%20Basis?\" target=\"_blank\"><IMG border=\"0\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/furl4.png\"><\/A><\/TD>\n<TD><A title=\"Post it to Netvouz!\" href=\"http:\/\/netvouz.com\/action\/submitBookmark?url=http:\/\/blogs.technet.com\/heyscriptingguy\/archive\/2009\/09\/17\/hey-scripting-guy-september-17-2009.aspx&amp;title=Hey,%20Scripting%20Guy!%20Can%20I%20Remove%20Specific%20Folder%20Access%20Rights%20on%20a%20Per-User%20Basis?\" target=\"_blank\"><IMG border=\"0\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/netvouz4.png\"><\/A><\/TD>\n<TD><A title=\"Post it to Reddit!\" href=\"http:\/\/reddit.com\/submit?url=http:\/\/blogs.technet.com\/heyscriptingguy\/archive\/2009\/09\/17\/hey-scripting-guy-september-17-2009.aspx&amp;title=Hey,%20Scripting%20Guy!%20Can%20I%20Remove%20Specific%20Folder%20Access%20Rights%20on%20a%20Per-User%20Basis?\" target=\"_blank\"><IMG border=\"0\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/reddit4.png\"><\/A><\/TD>\n<TD><A title=\"Post it to Spurl!\" href=\"http:\/\/www.spurl.net\/spurl.php?v=3&amp;url=http:\/\/blogs.technet.com\/heyscriptingguy\/archive\/2009\/09\/17\/hey-scripting-guy-september-17-2009.aspx&amp;title=Hey,%20Scripting%20Guy!%20Can%20I%20Remove%20Specific%20Folder%20Access%20Rights%20on%20a%20Per-User%20Basis?\" target=\"_blank\"><IMG border=\"0\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/spurl8.png\"><\/A><\/TD>\n<TD><A title=\"Post it to Technorati!\" href=\"http:\/\/technorati.com\/faves\/?add=http:\/\/blogs.technet.com\/heyscriptingguy\/archive\/2009\/09\/17\/hey-scripting-guy-september-17-2009.aspx&amp;title=Hey,%20Scripting%20Guy!%20Can%20I%20Remove%20Specific%20Folder%20Access%20Rights%20on%20a%20Per-User%20Basis?\" target=\"_blank\"><IMG border=\"0\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/technora4.png\"><\/A><\/TD>\n<TD><A title=\"Post it to Wists!\" href=\"http:\/\/www.wists.com\/?action=add&amp;url=http:\/\/blogs.technet.com\/heyscriptingguy\/archive\/2009\/09\/17\/hey-scripting-guy-september-17-2009.aspx&amp;title=Hey,%20Scripting%20Guy!%20Can%20I%20Remove%20Specific%20Folder%20Access%20Rights%20on%20a%20Per-User%20Basis?\" target=\"_blank\"><IMG border=\"0\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/wists9.png\"><\/A><\/TD>\n<TD><A title=\"Post it to Yahoo!\" href=\"http:\/\/myweb.yahoo.com\/myresults\/bookmarklet?u=http:\/\/blogs.technet.com\/heyscriptingguy\/archive\/2009\/09\/17\/hey-scripting-guy-september-17-2009.aspx&amp;t=Hey,%20Scripting%20Guy!%20Can%20I%20Remove%20Specific%20Folder%20Access%20Rights%20on%20a%20Per-User%20Basis?\" target=\"_blank\"><IMG border=\"0\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/yahoo9.png\"><\/A><\/TD><\/TR><\/TBODY><\/TABLE><\/SPAN>\n<P class=\"MsoNormal\"><SPAN><IMG class=\"nearGraphic\" title=\"Hey, Scripting Guy! Question\" border=\"0\" alt=\"Hey, Scripting Guy! Question\" align=\"left\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/q-for-powertip.jpg\" width=\"34\" height=\"34\"><\/SPAN>Hey, Scripting Guy! There is this guy at work\u2026well, actually he used to be at work and that is the problem. He left the company. The way security has been implemented at our company, I have to check specific folders, and if a user has been granted explicit access rights to the folders, the entry needs to be removed. I know I could do this manually, but there are several folders and I would rather not waste the time doing this task if it could be scripted. Do you have a script that will do this for me? <\/P>\n<P>&#8212; SC <\/P>\n<P><IMG class=\"nearGraphic\" title=\"Hey, Scripting Guy! Answer\" border=\"0\" alt=\"Hey, Scripting Guy! Answer\" align=\"left\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/a-for-powertip.jpg\" width=\"34\" height=\"34\"> Hello SC, <\/P>\n<P class=\"MsoNormal\">Microsoft Scripting Guy Ed Wilson here. It has seemed like fall weather here in Charlotte, North Carolina, in the United States this week. Gentle breezes have been nudging leaves from reluctant trees in my front yard, and the sky has been a dark blue dotted with white fluffy clouds. This is the first time in more than five years that I have been home to enjoy this time of the year. I am sifting through the e-mail that has been sent to <A href=\"mailto:scripter@microsoft.com\">scripter@microsoft.com<\/A>, sipping on a cup of <A href=\"http:\/\/en.wikipedia.org\/wiki\/Earl_Grey_tea\"><FONT face=\"Segoe\">Earl Grey tea<\/FONT><\/A>, and munching on a hunk of <A href=\"http:\/\/en.wikipedia.org\/wiki\/Artisan_cheese\"><FONT face=\"Segoe\">artisan cheese<\/FONT><\/A> while listening to <A href=\"http:\/\/en.wikipedia.org\/wiki\/Vanessa-Mae\">Vanessa-Mae<\/A> on my <A href=\"http:\/\/www.zune.net\/\">Zune<\/A><FONT face=\"Segoe\"><\/FONT>.<SPAN>&nbsp; <\/SPAN>Needless to say, I am in one of the best moods I have been in a very long time. The reason that this is significant is because most of the time when I am confronted with a security type of question I say use either <A href=\"http:\/\/www.microsoft.com\/downloads\/details.aspx?familyid=E8BA3E56-D8FE-4A91-93CF-ED6985E3927B&amp;displaylang=en\">Subinacl<\/A><FONT face=\"Segoe\"><\/FONT> or use <A href=\"http:\/\/technet.microsoft.com\/en-us\/library\/cc753525(WS.10).aspx\">Icacls<\/A><FONT face=\"Segoe\"><\/FONT>. Because I am in a good mood, I am susceptible to suggestion. The script I came up with is similar to the script I wrote on <A href=\"http:\/\/blogs.technet.com\/heyscriptingguy\/archive\/2009\/09\/15\/hey-scripting-guy-september-15-2009.aspx\">Tuesday<\/A>. <BR><\/P>\n<P class=\"MsoNormal\">The complete RemoveUserSecurityFromFolder.ps1 script is seen here. <\/P>\n<P class=\"CodeBlockScreenedHead\"><B>RemoveUserSecurityFromFolder.ps1 <\/B><\/P>\n<P class=\"CodeBlockScreened\"><SPAN><FONT><FONT face=\"Lucida Sans Typewriter\">$user = &#8216;nwtraders\\bob&#8217; <BR>$folders = &#8220;c:\\fso&#8221;,&#8221;c:\\fso1&#8243;, &#8220;c:\\fso2&#8221; <BR>$acls = Get-Acl -path $folders <BR>$outputObject = @() <BR><BR>Foreach($acl in $acls) <BR>{ <BR><SPAN>&nbsp;<\/SPAN>$folder = (convert-path $acl.pspath) <BR><SPAN>&nbsp;<\/SPAN>Write-Progress -act &#8220;Getting Security&#8221; -status &#8220;checking $folder&#8221; -percent ($i\/ $folders.count*100) <BR><SPAN>&nbsp;<\/SPAN> <BR><SPAN>&nbsp; <\/SPAN>Foreach($access in $acl.access) <BR><SPAN>&nbsp; <\/SPAN>{ <BR><SPAN>&nbsp;&nbsp;&nbsp; <\/SPAN>Foreach($value in $access.identityReference.Value) <BR><SPAN>&nbsp;&nbsp;&nbsp;&nbsp; <\/SPAN>{ <BR><SPAN>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/SPAN>if ($value -eq $user) <BR><SPAN>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/SPAN>{ <BR><SPAN>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/SPAN>$acl.RemoveAccessRule($access) | Out-Null <BR><SPAN>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/SPAN>} <BR><SPAN>&nbsp;&nbsp;&nbsp;&nbsp; <\/SPAN>} #end foreach value <BR><SPAN>&nbsp; <\/SPAN>} # end foreach access <BR><SPAN>&nbsp;<\/SPAN>Set-Acl -path $folder -aclObject $acl <BR>$i++ <BR>} #end Foreach acl <\/FONT><\/FONT><\/SPAN><\/P>\n<P class=\"MsoNormal\">The first thing that must be done in the RemoveUserSecurityFromFolder.ps1 script is to create a variable to hold the user name and the folders to be searched. The user name is expressed in the form of <B>DomainName\\UserName<\/B>. Each folder path is a string that includes the full path to the folder. Multiple folders can be supplied as long as they are separated by commas. This is seen here: <\/P>\n<P class=\"CodeBlock\"><SPAN><FONT face=\"Lucida Sans Typewriter\">$user = &#8216;nwtraders\\bob&#8217; <\/FONT><\/SPAN><\/P>\n<P class=\"CodeBlock\"><SPAN><FONT face=\"Lucida Sans Typewriter\">$folders = &#8220;c:\\fso&#8221;,&#8221;c:\\fso1&#8243;, &#8220;c:\\fso2&#8221; <BR><\/FONT><\/SPAN><\/P>\n<P class=\"MsoNormal\">As seen in the following image, the user <B>nwtraders\\bob <\/B>has been granted specific rights to the <B>C:\\fso2<\/B> folder. He has also been granted specific rights to other folders. The RemoveUserSecurityFromFolder.ps1 script will be used to remove his access to the folders specified in the <B>$folders <\/B>array. <\/P>\n<P class=\"Fig-Graphic\"><\/P>\n<P><IMG title=\"Image of specific user granted specific rights\" alt=\"Image of specific user granted specific rights\" src=\"http:\/\/img.microsoft.com\/library\/media\/1033\/technet\/images\/scriptcenter\/qanda\/hsg\/2009\/september\/hey0917\/hsg-09-17-09-01.jpg\" width=\"367\" height=\"474\"><\/P>\n<P class=\"MsoNormal\">After you have the user name and the folders to be searched, you use the <B>Get-Acl<\/B> Windows PowerShell cmdlet to return a collection of <A href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/system.security.accesscontrol.directorysecurity.aspx\">System.Security.AccessControl.DirectorySecurity<\/A> objects. The <B>DirectorySecurity<\/B> objects are stored in the <B>$acls<\/B> variable. This is shown here: <BR><\/P>\n<P class=\"CodeBlock\"><SPAN><FONT face=\"Lucida Sans Typewriter\">$acls = Get-Acl -path $folders <\/FONT><\/SPAN><\/P>\n<P class=\"MsoNormal\">Because you need to inspect individual access control entries, you will need to use the <B>Foreach<\/B> statement to walk through the collection of <B>DirectorySecurity<\/B> objects that are stored in the <B>$acls<\/B> variable. Each <B>DirectorySecurity<\/B> object will be stored in the <B>$acl<\/B> variable as you iterate through the collection. The <B>Foreach<\/B> statement is seen here: <\/P>\n<P class=\"CodeBlock\"><SPAN><FONT face=\"Lucida Sans Typewriter\">Foreach($acl in $acls) <\/FONT><\/SPAN><\/P>\n<P class=\"CodeBlock\"><SPAN><FONT face=\"Lucida Sans Typewriter\">{ <\/FONT><\/SPAN><\/P>\n<P>The path to the current folder is retrieved from the <B>pspath<\/B> property of the <B>System.Security.AccessControl.DirectorySecurity<\/B> .NET Framework class. The folder path is used in the status of the <B>Write-Progress<\/B> cmdlet, which displays a progress bar that informs the user of the status of removing the user from the folders. For more information about the use of <B>Convert-Path<\/B> or the <B>Write-Progress<\/B> cmdlet, see <A href=\"http:\/\/blogs.technet.com\/heyscriptingguy\/archive\/2009\/09\/15\/hey-scripting-guy-september-15-2009.aspx\">Tuesday\u2019s Hey, Scripting Guy! post<\/A>. The code is shown here: <\/P>\n<P class=\"CodeBlock\"><SPAN><FONT face=\"Lucida Sans Typewriter\">$folder = (convert-path $acl.pspath) <\/FONT><\/SPAN><\/P>\n<P class=\"CodeBlock\"><SPAN><FONT face=\"Lucida Sans Typewriter\"><SPAN>&nbsp;<\/SPAN>Write-Progress -act &#8220;Getting Security&#8221; -status &#8220;checking $folder&#8221; -percent ($i\/ $folders.count*100) <\/FONT><\/SPAN><\/P>\n<P class=\"MsoNormal\">It is time to walk through the individual access control entries. Because the user name that has been granted rights to a folder is stored in the value of the <B>identityReference<\/B> property of the <A href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/system.security.principal.ntaccount.aspx\">System.Security.Principal.NTAccount<\/A> .NET Framework class, it is necessary to somehow gain access to the <B>NTAccount<\/B> class.<SPAN>&nbsp; <\/SPAN>To do this, each of the <A href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/system.security.accesscontrol.filesystemaccessrule.aspx\">System.Security.AccessControl.FileSystemAccessRule<\/A> .NET Framework classes that are returned by querying the access property of the <B>DirectorySecurity<\/B> object are queried. The <B>Foreach<\/B> statement is used to walk through the collection of <B>FileSystemAccessRules<\/B> as seen here: <\/P>\n<P class=\"CodeBlock\"><SPAN><FONT face=\"Lucida Sans Typewriter\"><SPAN>&nbsp; <\/SPAN>Foreach($access in $acl.access) <\/FONT><\/SPAN><\/P>\n<P class=\"CodeBlock\"><SPAN><FONT face=\"Lucida Sans Typewriter\"><SPAN>&nbsp; <\/SPAN>{ <\/FONT><\/SPAN><\/P>\n<P class=\"MsoNormal\">After a specific <B>FileSystemAccessRule<\/B> has been obtained and stored in the <B>$access<\/B> variable, the <B>NTAccount<\/B> class is obtained by referencing the <B>identityReference<\/B> property.<SPAN>&nbsp; <\/SPAN>The value contained in <B>value<\/B> property is stored in the <B>$value<\/B> variable as seen here: <\/P>\n<P class=\"CodeBlock\"><SPAN><FONT face=\"Lucida Sans Typewriter\"><SPAN>&nbsp;&nbsp;&nbsp; <\/SPAN>Foreach($value in $access.identityReference.Value) <\/FONT><\/SPAN><\/P>\n<P class=\"CodeBlock\"><SPAN><FONT face=\"Lucida Sans Typewriter\"><SPAN>&nbsp;&nbsp;&nbsp;&nbsp; <\/SPAN>{ <\/FONT><\/SPAN><\/P>\n<P class=\"CodeBlock\"><SPAN><FONT face=\"Lucida Sans Typewriter\"><SPAN>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/SPAN>if ($value -eq $user) <\/FONT><\/SPAN><\/P>\n<P class=\"MsoNormal\">If the user matches the value of the <B>identityReference<\/B> property, the <B>FileSystemAccessRule<\/B> is removed from the <B>System.Security.AccessControl.DirectorySecurity<\/B> object. The information that is returned from the <B>RemoveAccessRule<\/B> method call is piped to the <B>Out-Null<\/B> cmdlet. This is shown here: <\/P>\n<P class=\"CodeBlock\"><SPAN><FONT face=\"Lucida Sans Typewriter\"><SPAN>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/SPAN>{ <\/FONT><\/SPAN><\/P>\n<P class=\"CodeBlock\"><SPAN><FONT face=\"Lucida Sans Typewriter\"><SPAN>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/SPAN>$acl.RemoveAccessRule($access) | Out-Null <\/FONT><\/SPAN><\/P>\n<P class=\"CodeBlock\"><SPAN><FONT face=\"Lucida Sans Typewriter\"><SPAN>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/SPAN>} <\/FONT><\/SPAN><\/P>\n<P class=\"CodeBlock\"><SPAN><FONT face=\"Lucida Sans Typewriter\"><SPAN>&nbsp;&nbsp;&nbsp;&nbsp; <\/SPAN>} #end foreach value <\/FONT><\/SPAN><\/P>\n<P class=\"CodeBlock\"><SPAN><FONT face=\"Lucida Sans Typewriter\"><SPAN>&nbsp; <\/SPAN>} # end foreach access <\/FONT><\/SPAN><\/P>\n<P class=\"MsoNormal\">It is time to commit the changes to the <B>DirectorySecurity<\/B> object. If you do not use the <B>Set-Acl<\/B> cmdlet to write the changes to the <B>DirectorySecurity<\/B> object, the script will appear to work properly, but the user will not be removed from access to the folders. To commit the changes, you specify the folder and the <B>aclObject<\/B>. For this script, the path to the folder is contained in the <B>$folder<\/B> variable and the <B>aclObject<\/B> is the <B>DirectorySecurity<\/B> object that is stored in the <B>$acl<\/B> variable. This line of code is seen here: <\/P>\n<P class=\"CodeBlock\"><SPAN><FONT face=\"Lucida Sans Typewriter\"><SPAN>&nbsp;<\/SPAN>Set-Acl -path $folder -aclObject $acl <\/FONT><\/SPAN><\/P>\n<P class=\"CodeBlock\"><SPAN><FONT face=\"Lucida Sans Typewriter\">$i++ <\/FONT><\/SPAN><\/P>\n<P class=\"CodeBlock\"><SPAN><FONT face=\"Lucida Sans Typewriter\">} #end Foreach acl <BR><\/FONT><\/SPAN><\/P>\n<P class=\"MsoNormal\">After the RemoveUserSecurityFromFolder.ps1 script has run, a quick inspection of the C:\\fso2 folder reveals that <B>nwtraders\\bob<\/B> has been removed. This is seen here: <\/P>\n<P><IMG title=\"Image of specific use removed from specific folder\" alt=\"Image of specific use removed from specific folder\" src=\"http:\/\/img.microsoft.com\/library\/media\/1033\/technet\/images\/scriptcenter\/qanda\/hsg\/2009\/september\/hey0917\/hsg-09-17-09-02.jpg\" width=\"367\" height=\"474\"><\/P>\n<P class=\"MsoNormal\">&nbsp;<\/P>\n<P class=\"MsoNormal\">Well, SC, that is all there is to removing a user\u2019s access rights to a folder. I am glad you asked the question because the process was not nearly as difficult as I had believed. This brings us to the end of our Security Week posts. Join us tomorrow as we dig into the virtual mail bag for questions that do not need quite as long of an answer. That is right: Tomorrow is Quick-Hits Friday! <\/P>\n<P class=\"MsoNormal\">If you want to know exactly what we will be looking at tomorrow, follow us on <A href=\"http:\/\/www.twitter.com\/scriptingguys\/\" target=\"_blank\">Twitter<\/A> or <A href=\"http:\/\/www.new.facebook.com\/group.php?gid=5901799452\" target=\"_blank\"><FONT face=\"Segoe\">Facebook<\/FONT><\/A>. If you have any questions, send e-mail to us at <A href=\"mailto:scripter@microsoft.com\" target=\"_blank\">scripter@microsoft.com<\/A> or post them on the <A href=\"http:\/\/social.technet.microsoft.com\/Forums\/en\/ITCG\/threads\/\" target=\"_blank\">Official Scripting Guys Forum<\/A>. See you tomorrow. Until then, keep on scripting. <\/P>\n<P><B><SPAN>Ed Wilson and Craig Liebendorfer, Scripting Guys <\/SPAN><\/B><B><\/P>\n<P><SPAN class=\"Apple-style-span\">fazpeux4s3<\/SPAN>&nbsp;<\/P><\/B>\n<P>&nbsp;<\/P><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Share this post: Hey, Scripting Guy! There is this guy at work\u2026well, actually he used to be at work and that is the problem. He left the company. The way security has been implemented at our company, I have to check specific folders, and if a user has been granted explicit access rights to the [&hellip;]<\/p>\n","protected":false},"author":595,"featured_media":87096,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[62,3,63,45],"class_list":["post-52443","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-scripting","tag-dacls-and-sacls","tag-scripting-guy","tag-security","tag-windows-powershell"],"acf":[],"blog_post_summary":"<p>Share this post: Hey, Scripting Guy! There is this guy at work\u2026well, actually he used to be at work and that is the problem. He left the company. The way security has been implemented at our company, I have to check specific folders, and if a user has been granted explicit access rights to the [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/posts\/52443","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/users\/595"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/comments?post=52443"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/posts\/52443\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/media\/87096"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/media?parent=52443"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/categories?post=52443"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/tags?post=52443"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}