Output the result into OGV from Custom {0}`t{1}`t{2}`t{3}`t{4} format?

1

How can the code below modified to be properly formatted into the Out-GridView?

The script below iterates through multiple OU in a list and then export the result of the ACL for Delegated ACL rights. Appendix: https://msdn.microsoft.com/en-us/library/windows/desktop/aa772285.aspx

$ADS_RIGHTS_ENUM = @{
    'ADS_RIGHT_DELETE'                 = 0x10000
    'ADS_RIGHT_READ_CONTROL'           = 0x20000
    'ADS_RIGHT_WRITE_DAC'              = 0x40000
    'ADS_RIGHT_WRITE_OWNER'            = 0x80000
    'ADS_RIGHT_SYNCHRONIZE'            = 0x100000
    'ADS_RIGHT_ACCESS_SYSTEM_SECURITY' = 0x1000000
    'ADS_RIGHT_GENERIC_READ'           = 0x80000000
    'ADS_RIGHT_GENERIC_WRITE'          = 0x40000000
    'ADS_RIGHT_GENERIC_EXECUTE'        = 0x20000000
    'ADS_RIGHT_GENERIC_ALL'            = 0x10000000
    'ADS_RIGHT_DS_CREATE_CHILD'        = 0x1
    'ADS_RIGHT_DS_DELETE_CHILD'        = 0x2
    'ADS_RIGHT_ACTRL_DS_LIST'          = 0x4
    'ADS_RIGHT_DS_SELF'                = 0x8
    'ADS_RIGHT_DS_READ_PROP'           = 0x10
    'ADS_RIGHT_DS_WRITE_PROP'          = 0x20
    'ADS_RIGHT_DS_DELETE_TREE'         = 0x40
    'ADS_RIGHT_DS_LIST_OBJECT'         = 0x80
    'ADS_RIGHT_DS_CONTROL_ACCESS'      = 0x100
}

$dn = @('OU=Computers,OU=Domain,DC=com', 'OU=Laptop,OU=Domain,DC=com')

$dn | ForEach-Object {
    $acl = Get-Acl "AD:\$_"
    foreach ($ace in $acl.Access) {
        $ADS_RIGHTS_ENUM.Keys | Where-Object {
            ($ace.ActiveDirectoryRights.value__ -band $ADS_RIGHTS_ENUM[$_]) -and ($ace.InheritanceFlags -ne 'ContainerInherit')
        } | ForEach-Object {
            "OU: {0}`t{1}`t{2}`t{3}`t{4}" -f $_.dn, $ace.IdentityReference, $_, $ace.ActiveDirectoryRights, $ace.AccessControlType
        }
    }
} | Out-GridView
powershell
active-directory

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0