The command Get-NTFSAccess
output displays column "Applies to"
, how can I read this value to a variable?
The command output is added to a variable, but I cannot read the Applies to column,
when I try $variable."Applies to"
nothing is returned. I tried with single quotes and curly braces, but no values are returned.
$Object = "C:\temp\testfolder"
$acl = Get-NTFSAccess -Path $Object
# Loop through each access rule in the ACL
foreach ($record in $acl) {
# Create a custom object to store the details
$result = [PSCustomObject]@{
FilePath = $Object
Principal = $record.Account
Type = $record.AccessControlType
Access = $record.AccessRights
Inherited = $record.IsInherited
InheritedFrom = $record.InheritedFrom
Scope = $record."Applies to"
}
# Add the result to the array
$results += $result
}