I'm reading some code and I can't figure out where a certain property, access, is being retrieved from.
Here is a snippet of the code I am looking at. I've removed some of the code. This code is part of a function, hence the return statements, but the rest of the func code isn't relevant to this post.
if ($targetObjType -eq "DirectoryInfo") {
$fileFolderObjs = @(Get-ChildItem $target -force -recurse -Directory -ErrorAction SilentlyContinue)
}
$fileFolderObjs | ForEach-Object {
$fileFolderObj = $_
try {
$ACL = $fileFolderObj.GetAccessControl()
}
catch {
write-host "error"
return
}
if (!$ACL) {
return
}
$access = $ACL | Select-Object -ExpandProperty Access #ACLs. Not seeing this property as existing in DirectorySecurity class documentation.
}
So I should be retrieving DirectoryInfo objects, calling GetAccessControl() on them, and getting a DirectorySecurity object back in return. The code runs properly and access property does return data, but I can't find any information in Microsoft docs for where this Access property comes from. It's not listed as a property on the DirectorySecurity object. Am I missing some object that DirectorySecurity inherits from?
Any help would be appreciated. Thanks
.Access
is a code property that contains a typeSystem.Security.AccessControl.AuthorizationRuleCollection
. It is an extended property. – Bacteroid