Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Permission from Folder

Posted on 2016-08-04
3
Medium Priority
?
82 Views
Last Modified: 2016-08-04
I need help is possible save the users list with permission and a folder?


Example

Folder 1

Permissions tab
user1
user2
user3


I nee save in save in a list the name of the folder and which user are in the permissions tab
0
Comment
Question by:PLCITS
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 12

Assisted Solution

by:Benjamin Voglar
Benjamin Voglar earned 500 total points
ID: 41742439
you can do it with powershell:

get-acl c:\it | select -expand access | ft

change c:\it with your path.

you can save the result in to a file:

get-acl c:\it | select -expand access | export-csv c:\it\list.csv
0
 
LVL 1

Assisted Solution

by:Christopher Milligan
Christopher Milligan earned 500 total points
ID: 41742458
I user a powershell script for this

[cmdletbinding()]

param([Parameter(ValueFromPipeline=$True,
    ValueFromPipelineByPropertyName=$True)]$Computer = '[b][u]COMPUTER NAME HERE[/u][/b]') 

$shares = gwmi -Class win32_share -ComputerName $computer | select -ExpandProperty Name 
 
foreach ($share in $shares) { 
    $acl = $null 
    Write-Host $share -ForegroundColor Green 
    Write-Host $('-' * $share.Length) -ForegroundColor Green 
    $objShareSec = Get-WMIObject -Class Win32_LogicalShareSecuritySetting -Filter "name='$Share'"  -ComputerName $computer
    try { 
        $SD = $objShareSec.GetSecurityDescriptor().Descriptor   
        foreach($ace in $SD.DACL){  
            $UserName = $ace.Trustee.Name     
            If ($ace.Trustee.Domain -ne $Null) {$UserName = "$($ace.Trustee.Domain)\$UserName"}   
            If ($ace.Trustee.Name -eq $Null) {$UserName = $ace.Trustee.SIDString }     
            [Array]$ACL += New-Object Security.AccessControl.FileSystemAccessRule($UserName, $ace.AccessMask, $ace.AceType) 
            } #end foreach ACE           
        } # end try 
    catch 
        { Write-Host "Unable to obtain permissions for $share" } 
    $ACL 
    Write-Host $('=' * 50) 
    } # end foreach $share

Open in new window

0
 
LVL 13

Accepted Solution

by:
Dustin Saunders earned 1000 total points
ID: 41742460
I recently answered a similar question, which has the code you are looking for.

See below code:
$OutFile = "C:\test\output.csv"
$LookFolder = "C:\test"

function getACL($Folders, $type)
{
    foreach ($Folder in $Folders){
	$ACLs = get-acl $Folder.Path | ForEach-Object { $_.Access  }
	Foreach ($ACL in $ACLs){
	$OutInfo = $Folder.Path + "," + $ACL.IdentityReference  +  "," + $ACL.IsInherited # Additional options:: + "," + $ACL.InheritanceFlags +"," + $ACL.AccessControlType + "," + $ACL.PropagationFlags
	Add-Content -Value $OutInfo -Path $OutFile
	}}
}

$nifolders = Get-ChildItem $LookFolder -recurse | ?{$_.PSIsContainer} | Select @{Name='Path';Expression={$_.FullName}},@{Name='InheritedCount';Expression={(Get-Acl $_.FullName | Select -ExpandProperty Access | Where { $_.IsInherited }).Count}} | Where { $_.InheritedCount -eq 0} | Select Path
$ifolders = Get-ChildItem $LookFolder -recurse | ?{$_.PSIsContainer} | Select @{Name='Path';Expression={$_.FullName}},@{Name='InheritedCount';Expression={(Get-Acl $_.FullName | Select -ExpandProperty Access | Where { $_.IsInherited }).Count}} | Where { $_.InheritedCount -gt 0} | Select Path

getACL($ifolders)
getACL($nifolders)

Open in new window


Where $lookFolder is the root you want to see.  This will show who has membership to the folder and if the folder has inheritance enabled.
0

Featured Post

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this modest contribution, I want to share with the IT community (especially system administrators, IT Support Engineers and IT Help Desks) about Windows crashes/hangs and how to deal with these particular problems.
By default Outlook 2016 displays only one time zone in the Calendar. The following article explains how to display two time zones in one calendar view.
Windows 8 came with a dramatically different user interface known as Metro. Notably missing from that interface was a Start button and Start Menu. Microsoft responded to negative user feedback of the Metro interface, bringing back the Start button a…
Finding and deleting duplicate (picture) files can be a time consuming task. My wife and I, our three kids and their families all share one dilemma: Managing our pictures. Between desktops, laptops, phones, tablets, and cameras; over the last decade…

688 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question