Author Posts

July 19, 2016 at 6:28 am

Hi everyone

I want list of Groups and their members users on a Folder

i have this folder "\\aunr-file-01\Bid Register" and i want the list of groups and sub groups and list of users in each group and type of permissions each group has and type of permission each user has.

till now i have done this only

Get-Acl -Path "\\aunr-file-01\Bid Register" | Format-List
and

get-childitem "\\aunr-file-01\Bid Register" -recurse | get-acl | select-object path,owner,accesstostring,group

but they are not solving my problem

please provide me some easy solution
Thank you in Advance

Vijay

July 20, 2016 at 4:13 am

Hi Craig Duff

I also wanted to get all the email address in a single text file separated by semi colon, then i can send email to all members of that group.

Regards
Ajay

July 20, 2016 at 2:23 pm

I've used the below module in the past to interrogate NTFS permissions, which it looks like you're trying to do. If you download and install it, the code I've provided should get you started. I've assumed the groups you want to get membership of are part of an Active Directory domain.

NTFSSecurity Module

Import-Module NTFSSecurity

$Results = @()
$Groups = Get-NTFSAccess C:\Scripts | ?{$_.AccountType -eq 'Group'}

foreach($Group in $Groups){
    $GroupName = $Null
    $GroupName = $Group.Account -replace ".*\\" , ""
    $GroupMembers = $Null
    $GroupMembers = Get-ADGroupMember -Identity $GroupName -Recursive
    foreach($Member in $GroupMembers){
        $User = Get-ADUser -Identity $Member.SamAccountName -Properties Mail | select Name, Mail
        $MyObject = [psCustomObject] @{
                                        User = $Member.Name
                                        Group = $GroupName
                                        Emailaddress = $User.Mail
        }

        $Results += $MyObject
    }                                       
}

$Results

July 25, 2016 at 4:50 am

Hi Paul

I am not able to install this module NTFSSecurity

Paul please guide me , how to install this.

PS C:\Windows\system32> Install-Module -Name NTFSSecurity -RequiredVersion 4.0.0
The term 'Install-Module' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spe
rect and try again.
At line:1 char:15
+ Install-Module <<< Thank You In Advance. Vijay.

July 25, 2016 at 1:18 pm

import-module not install-module. Unless you are very strict with the mail attribute you should probably use the primary smtp out of the proxyaddresses attribute. These don't always match.

July 25, 2016 at 3:06 pm

i downloaded a zip file of NTFSSecurity and then extracted in c:\windows\windows32\windowspowershell\v1\modules\ folder.

still it gives error in importing the ntfs security files. it says that some files could not be loaded .

July 26, 2016 at 4:20 am

this is the error , i am getting

Import-Module : The specified module 'PowerShellAccessControl_cSecurityDescriptorSddl' was not loaded because no valid module file was found in any

module directory.
At line:24 char:34
+ Import-Module <<<< $_.Name -ErrorAction SilentlyContinue + CategoryInfo : ResourceUnavailable: (PowerShellAcces...yDescriptorSddl:String) [Import-Module], FileNotFoundException + FullyQualifiedErrorId : Modules_ModuleNotFound,Microsoft.PowerShell.Commands.ImportModuleCommand Import-Module : The specified module 'PowerShellAccessControl_cSecurityDescriptor' was not loaded because no valid module file was found in any module directory. At line:24 char:34 + Import-Module <<<< $_.Name -ErrorAction SilentlyContinue + CategoryInfo : ResourceUnavailable: (PowerShellAcces...urityDescriptor:String) [Import-Module], FileNotFoundException + FullyQualifiedErrorId : Modules_ModuleNotFound,Microsoft.PowerShell.Commands.ImportModuleCommand Import-Module : The specified module 'PowerShellAccessControl_cAccessControlEntry' was not loaded because no valid module file was found in any module directory. At line:24 char:34 + Import-Module <<<