Skip to content

FileSystemAclExtensions::GetAccessControl does not work until using Get-Acl once #18896

@Northman-de

Description

@Northman-de

Prerequisites

Steps to reproduce

I have a script to create a report on filesystem permissions. For performance reasons I use [System.IO.FileSystemAclExtensions]::GetAccessControl() instead of Get-Acl.
This is working fine in 7,1.3 but does not work in 7.3.1 or 7.4.0-preview.1

Steps to reproduce:

 [System.IO.FileSystemAclExtensions]::GetAccessControl( [System.IO.DirectoryInfo]::new( "c:\windows"))

It will provide the expected output after using Get-Acl once, regardless of the path (e.g. Get-Acl HKCU:).

Expected behavior

Path Owner                       Access
---- -----                       ------
     NT SERVICE\TrustedInstaller CREATOR OWNER Allow  268435456…

Actual behavior

Path Owner Access
---- ----- ------

Error details

No response

Environment data

Name                           Value
----                           -----
PSVersion                      7.3.1
PSEdition                      Core
GitCommitId                    7.3.1
OS                             Microsoft Windows 10.0.19045
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Visuals

Issue_GetAccessControl

Metadata

Metadata

Assignees

No one assigned

    Labels

    Issue-Questionideally support can be provided via other mechanisms, but sometimes folks do open an issue to get aNeeds-TriageThe issue is new and needs to be triaged by a work group.Resolution-AnsweredThe question is answered.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions