Get NTFS permissions in a ListBox.

Hello again!

I'm still busy working on an application for managers to add users in a security group in Active Directory.

What I have now is an form with a button that lets managers select a folder they want to see permissions on, and when they press the ok button it writes the location to a variable.


What I want is that the NTFS permissions are displayed in a ListBox so that a manager can select a group and press a button which adds a user to that group.


The code I have now for displaying NTFS permissions is:

$permissies = Get-ACL $resultaatfolder | Select-Object  @{n='Accesstostring';e={ [String]::Join("`n", $( $_.Access | %{"$($_.IdentityReference)" })) }}

And the code which should add them 1 by 1:



But what happens is this:

It places all the groups/users on 1 entry..


I just want to see the NTFS permissions 1 by 1, so that each group is 1 entry.

Could you please help me out? I am stuck on this one...


Your help will be highly appreciated!


No Data
  • You need an array of permissions:

    $permissies = Get-ACL $resultaatfolder | select -expand access | select -expand identityreference | select -expand value

    And then you need to add them one by one by using foreach statement:

    foreach ($permissie in $permissies) {