Remove Specific User's Share Permission

Remove specific user from share folder's share permission list

 
 
 
 
 
4.7 Star
(3)
Add to favorites
Storage
4/21/2010
E-mail Twitter del.icio.us Digg Facebook
  • Working with various groups (not just Specific Users)
    1 Posts | Last post January 31, 2019
    • More of a comment than a question...
      Thanks for the code. In our situation, we needed to be able to remove "Everyone", which doesn't have domain associated with it. I just had to adjust the GetIndexOf Function and it started working. We also couldn't use the newer cmdlets for removing access. Updated function below.
      
      function GetIndexOf($DACLs,$Domain,$Username) 
      { 
      	$Index = -1; 
          for($i = 0; $i -le ($DACLs.Count - 1); $i += 1) 
          {
              $Trustee = $DACLs[$i].Trustee 
              $CurrentDomain = $Trustee.Domain
              $CurrentUsername = $Trustee.Name
      	#The line below fixes this for the Everyone group
      	If (($CurrentDomain -eq $null) -AND($Domain -eq "")) {$CurrentDomain = ""}
               
              if(($CurrentDomain -eq $Domain) -and ($CurrentUsername -eq $Username)) { 
      			$Index = $i
              }
          }
      	return $Index
      } 
  • Passing Wildcards
    2 Posts | Last post April 03, 2014
    • Is there a way to simply remove ACE's from the share using a 'like' or 'startswith' operator.  I need to remove hundreds of objects from thousands of shares and and supporting like or startswith would save many hours of time.
    • First my apologies for not seeing this until now. 
      
      You certainly can use these operators to identify a share. Can you provide a little more detail regarding the criteria you are looking for?