How can I define a FileSystemAccessRule in PowerShell that has the property IsInherited set to true?

44 Views Asked by At

For testing purposes I want to define a FileSystemAccessRule with the property IsInherited set to true in PowerShell, for example:

FileSystemRights  : FullControl
AccessControlType : Allow
IdentityReference : NT AUTHORITY\SYSTEM
IsInherited       : True
InheritanceFlags  : None
PropagationFlags  : None

However, the constructors for FileSystemAccessRule do not seem to contain any parameters that modify this property, only the other 5 properties. Furthermore, the property is ReadOnly. So when I try to modify it after it has been created:

$fileSystemAccessRule.IsInherited = $true

The following error is thrown: 'IsInherited' is a ReadOnly property.

How can I create a FileSystemAccessRule with IsInherited set to true, so I can test it against existing access rules for given files?

0

There are 0 best solutions below