You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

120 lines
6.8 KiB

7 years ago
---
external help file: NTFSSecurity.dll-Help.xml
Ai/docs alignment (#91) * chore: initialize the memory bank Add the canonical .memory-bank base with evidence-based project context: purpose and scope, workflows, stack and validation commands, architecture map, decisions, and the open work found while documenting the cmdlets. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Co-authored-by: AI Assistant <ai@example.com> * docs: align documentation with the cmdlet source - Fill all 36 platyPS cmdlet pages from the C# source: synopsis, description, parameters, defaults, examples, inputs, outputs, and notes, including documented limitations of the current code - Check every example against live parameter metadata and run them in a sandbox; fix examples that did not work (CSV restore, account filter, recursive inheritance, -AccessRights typos) - Rewrite the home, concepts, examples, README, and contributor pages; add a grouped cmdlet overview, module settings, privileges, long paths, and the platyPS workflow - Document Remove-Item2 -PassThru as renamed after 4.2.6 (#64) - Fix mkdocs.yml navigation, edit_uri, and copyright markup; add build.os and a pinned MkDocs version for Read the Docs - Point online help links to the pages on GitHub; add CHANGELOG.md Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Co-authored-by: AI Assistant <ai@example.com> * ci: build the module and check the docs against the build The documentation check ran Update-MarkdownHelp against the NTFSSecurity release from the PowerShell Gallery (4.2.6), so it failed for every unreleased parameter change. PR #91 failed because 4.2.6 still has Remove-Item2 -PassThur while the source and the docs have -PassThru. - Build NTFSSecurity.csproj in Release on the Visual Studio 2022 image, using the .NET Framework 4.5.2 reference assemblies package instead of an installed targeting pack - Check Docs/Cmdlets against the module built from source - Pin platyPS 0.14.2 and MarkdownLinkCheck 0.2.0, and enable TLS 1.2 so the NuGet provider bootstrap works Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Co-authored-by: AI Assistant <ai@example.com> * chore: record the green PR 91 build in the memory bank Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Co-authored-by: AI Assistant <ai@example.com> --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Co-authored-by: AI Assistant <ai@example.com>
4 weeks ago
Module Name: NTFSSecurity
online version: https://github.com/raandree/NTFSSecurity/blob/master/Docs/Cmdlets/Get-NTFSSecurityDescriptor.md
7 years ago
schema: 2.0.0
---
# Get-NTFSSecurityDescriptor
## SYNOPSIS
Ai/docs alignment (#91) * chore: initialize the memory bank Add the canonical .memory-bank base with evidence-based project context: purpose and scope, workflows, stack and validation commands, architecture map, decisions, and the open work found while documenting the cmdlets. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Co-authored-by: AI Assistant <ai@example.com> * docs: align documentation with the cmdlet source - Fill all 36 platyPS cmdlet pages from the C# source: synopsis, description, parameters, defaults, examples, inputs, outputs, and notes, including documented limitations of the current code - Check every example against live parameter metadata and run them in a sandbox; fix examples that did not work (CSV restore, account filter, recursive inheritance, -AccessRights typos) - Rewrite the home, concepts, examples, README, and contributor pages; add a grouped cmdlet overview, module settings, privileges, long paths, and the platyPS workflow - Document Remove-Item2 -PassThru as renamed after 4.2.6 (#64) - Fix mkdocs.yml navigation, edit_uri, and copyright markup; add build.os and a pinned MkDocs version for Read the Docs - Point online help links to the pages on GitHub; add CHANGELOG.md Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Co-authored-by: AI Assistant <ai@example.com> * ci: build the module and check the docs against the build The documentation check ran Update-MarkdownHelp against the NTFSSecurity release from the PowerShell Gallery (4.2.6), so it failed for every unreleased parameter change. PR #91 failed because 4.2.6 still has Remove-Item2 -PassThur while the source and the docs have -PassThru. - Build NTFSSecurity.csproj in Release on the Visual Studio 2022 image, using the .NET Framework 4.5.2 reference assemblies package instead of an installed targeting pack - Check Docs/Cmdlets against the module built from source - Pin platyPS 0.14.2 and MarkdownLinkCheck 0.2.0, and enable TLS 1.2 so the NuGet provider bootstrap works Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Co-authored-by: AI Assistant <ai@example.com> * chore: record the green PR 91 build in the memory bank Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Co-authored-by: AI Assistant <ai@example.com> --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Co-authored-by: AI Assistant <ai@example.com>
4 weeks ago
Gets the security descriptor of a file or folder.
7 years ago
## SYNTAX
```
7 years ago
Get-NTFSSecurityDescriptor [[-Path] <String[]>] [<CommonParameters>]
```
## DESCRIPTION
Ai/docs alignment (#91) * chore: initialize the memory bank Add the canonical .memory-bank base with evidence-based project context: purpose and scope, workflows, stack and validation commands, architecture map, decisions, and the open work found while documenting the cmdlets. Co-authored-by: Copilot &lt;223556219+Copilot@users.noreply.github.com&gt; Co-authored-by: AI Assistant &lt;ai@example.com&gt; * docs: align documentation with the cmdlet source - Fill all 36 platyPS cmdlet pages from the C# source: synopsis, description, parameters, defaults, examples, inputs, outputs, and notes, including documented limitations of the current code - Check every example against live parameter metadata and run them in a sandbox; fix examples that did not work (CSV restore, account filter, recursive inheritance, -AccessRights typos) - Rewrite the home, concepts, examples, README, and contributor pages; add a grouped cmdlet overview, module settings, privileges, long paths, and the platyPS workflow - Document Remove-Item2 -PassThru as renamed after 4.2.6 (#64) - Fix mkdocs.yml navigation, edit_uri, and copyright markup; add build.os and a pinned MkDocs version for Read the Docs - Point online help links to the pages on GitHub; add CHANGELOG.md Co-authored-by: Copilot &lt;223556219+Copilot@users.noreply.github.com&gt; Co-authored-by: AI Assistant &lt;ai@example.com&gt; * ci: build the module and check the docs against the build The documentation check ran Update-MarkdownHelp against the NTFSSecurity release from the PowerShell Gallery (4.2.6), so it failed for every unreleased parameter change. PR #91 failed because 4.2.6 still has Remove-Item2 -PassThur while the source and the docs have -PassThru. - Build NTFSSecurity.csproj in Release on the Visual Studio 2022 image, using the .NET Framework 4.5.2 reference assemblies package instead of an installed targeting pack - Check Docs/Cmdlets against the module built from source - Pin platyPS 0.14.2 and MarkdownLinkCheck 0.2.0, and enable TLS 1.2 so the NuGet provider bootstrap works Co-authored-by: Copilot &lt;223556219+Copilot@users.noreply.github.com&gt; Co-authored-by: AI Assistant &lt;ai@example.com&gt; * chore: record the green PR 91 build in the memory bank Co-authored-by: Copilot &lt;223556219+Copilot@users.noreply.github.com&gt; Co-authored-by: AI Assistant &lt;ai@example.com&gt; --------- Co-authored-by: Copilot &lt;223556219+Copilot@users.noreply.github.com&gt; Co-authored-by: AI Assistant &lt;ai@example.com&gt;
4 weeks ago
The `Get-NTFSSecurityDescriptor` cmdlet reads the security descriptor of a file or folder into memory and returns it as a `Security2.FileSystemSecurity2` object. A security descriptor holds the owner of an item, its primary group, the discretionary access control list (DACL) that grants or denies access, and the system access control list (SACL) that controls auditing.
fix: write only the sections of the security descriptor that a cmdlet changes The access and audit cmdlets wrote the owner of an item back with the entries they changed. For a DACL without the auto-inherit flag, Windows returns the owner and the group even when only the DACL is read, and the cmdlets wrote every section that the descriptor held. Without the Restore privilege, or on a file server that refuses the owner, the write failed with error 1307 (#34). - Add-NTFSAccess, Clear-NTFSAccess, Add-NTFSAudit, and Clear-NTFSAudit read only the DACL or the SACL. FileSystemSecurity2.Write(), Remove-NTFSAccess, and Remove-NTFSAudit write only the sections they read, which also fixes the access inheritance cmdlets. - Read together with the SACL, the inherited entries of such a DACL lose their inherited flag when the parent folder has no SACL, and the cmdlets stored them as explicit copies. Get-NTFSSecurityDescriptor now reads the DACL in a separate call. - Set-NTFSSecurityDescriptor writes only the sections that changed since they were read; an unchanged descriptor writes nothing (maintainer decision of 2026-10-06). - Clear-NTFSAudit writes nothing for an item without a SACL, and reports an error without the Security privilege (maintainer decision). The regression tests failed before and pass after the fix in Windows PowerShell 5.1 and PowerShell 7, elevated and as a basic user. Co-authored-by: Copilot &lt;223556219+Copilot@users.noreply.github.com&gt; Co-authored-by: AI Assistant &lt;ai@example.com&gt;
4 weeks ago
The returned object is the starting point of the security descriptor workflow. Many cmdlets of the module accept it through a `-SecurityDescriptor` parameter and then change the copy in memory instead of the file system, among them `Add-NTFSAccess`, `Remove-NTFSAccess`, `Clear-NTFSAccess`, `Add-NTFSAudit`, `Remove-NTFSAudit`, `Clear-NTFSAudit`, `Set-NTFSInheritance`, `Enable-NTFSAccessInheritance`, `Disable-NTFSAccessInheritance`, and `Set-NTFSOwner`. Nothing reaches the disk until you pass the descriptor to `Set-NTFSSecurityDescriptor`, which makes it possible to collect several changes and apply them in a single write; that cmdlet writes only the sections that changed. Discard the variable to discard the changes.
Ai/docs alignment (#91) * chore: initialize the memory bank Add the canonical .memory-bank base with evidence-based project context: purpose and scope, workflows, stack and validation commands, architecture map, decisions, and the open work found while documenting the cmdlets. Co-authored-by: Copilot &lt;223556219+Copilot@users.noreply.github.com&gt; Co-authored-by: AI Assistant &lt;ai@example.com&gt; * docs: align documentation with the cmdlet source - Fill all 36 platyPS cmdlet pages from the C# source: synopsis, description, parameters, defaults, examples, inputs, outputs, and notes, including documented limitations of the current code - Check every example against live parameter metadata and run them in a sandbox; fix examples that did not work (CSV restore, account filter, recursive inheritance, -AccessRights typos) - Rewrite the home, concepts, examples, README, and contributor pages; add a grouped cmdlet overview, module settings, privileges, long paths, and the platyPS workflow - Document Remove-Item2 -PassThru as renamed after 4.2.6 (#64) - Fix mkdocs.yml navigation, edit_uri, and copyright markup; add build.os and a pinned MkDocs version for Read the Docs - Point online help links to the pages on GitHub; add CHANGELOG.md Co-authored-by: Copilot &lt;223556219+Copilot@users.noreply.github.com&gt; Co-authored-by: AI Assistant &lt;ai@example.com&gt; * ci: build the module and check the docs against the build The documentation check ran Update-MarkdownHelp against the NTFSSecurity release from the PowerShell Gallery (4.2.6), so it failed for every unreleased parameter change. PR #91 failed because 4.2.6 still has Remove-Item2 -PassThur while the source and the docs have -PassThru. - Build NTFSSecurity.csproj in Release on the Visual Studio 2022 image, using the .NET Framework 4.5.2 reference assemblies package instead of an installed targeting pack - Check Docs/Cmdlets against the module built from source - Pin platyPS 0.14.2 and MarkdownLinkCheck 0.2.0, and enable TLS 1.2 so the NuGet provider bootstrap works Co-authored-by: Copilot &lt;223556219+Copilot@users.noreply.github.com&gt; Co-authored-by: AI Assistant &lt;ai@example.com&gt; * chore: record the green PR 91 build in the memory bank Co-authored-by: Copilot &lt;223556219+Copilot@users.noreply.github.com&gt; Co-authored-by: AI Assistant &lt;ai@example.com&gt; --------- Co-authored-by: Copilot &lt;223556219+Copilot@users.noreply.github.com&gt; Co-authored-by: AI Assistant &lt;ai@example.com&gt;
4 weeks ago
fix: write only the sections of the security descriptor that a cmdlet changes The access and audit cmdlets wrote the owner of an item back with the entries they changed. For a DACL without the auto-inherit flag, Windows returns the owner and the group even when only the DACL is read, and the cmdlets wrote every section that the descriptor held. Without the Restore privilege, or on a file server that refuses the owner, the write failed with error 1307 (#34). - Add-NTFSAccess, Clear-NTFSAccess, Add-NTFSAudit, and Clear-NTFSAudit read only the DACL or the SACL. FileSystemSecurity2.Write(), Remove-NTFSAccess, and Remove-NTFSAudit write only the sections they read, which also fixes the access inheritance cmdlets. - Read together with the SACL, the inherited entries of such a DACL lose their inherited flag when the parent folder has no SACL, and the cmdlets stored them as explicit copies. Get-NTFSSecurityDescriptor now reads the DACL in a separate call. - Set-NTFSSecurityDescriptor writes only the sections that changed since they were read; an unchanged descriptor writes nothing (maintainer decision of 2026-10-06). - Clear-NTFSAudit writes nothing for an item without a SACL, and reports an error without the Security privilege (maintainer decision). The regression tests failed before and pass after the fix in Windows PowerShell 5.1 and PowerShell 7, elevated and as a basic user. Co-authored-by: Copilot &lt;223556219+Copilot@users.noreply.github.com&gt; Co-authored-by: AI Assistant &lt;ai@example.com&gt;
4 weeks ago
The cmdlet reads all sections of the descriptor. When that fails, for example because the session may not read the SACL, it falls back to the access, owner, and group sections, and then to the access section alone. When the cmdlet reads the SACL, it reads the DACL in a separate call, so that the inherited access entries keep their inherited flag. Before 5.0.0, it read the DACL together with the SACL, and Windows could return the inherited entries without that flag; a descriptor written back then stored them as explicit entries. `-Path` accepts pipeline input by value and by property name through its `FullName` alias, so the output of `Get-ChildItem2`, `Get-Item2`, and `Get-ChildItem` binds to it. Relative paths are resolved against the current location, and when you omit `-Path` entirely, the cmdlet returns the descriptor of the current location.
Ai/docs alignment (#91) * chore: initialize the memory bank Add the canonical .memory-bank base with evidence-based project context: purpose and scope, workflows, stack and validation commands, architecture map, decisions, and the open work found while documenting the cmdlets. Co-authored-by: Copilot &lt;223556219+Copilot@users.noreply.github.com&gt; Co-authored-by: AI Assistant &lt;ai@example.com&gt; * docs: align documentation with the cmdlet source - Fill all 36 platyPS cmdlet pages from the C# source: synopsis, description, parameters, defaults, examples, inputs, outputs, and notes, including documented limitations of the current code - Check every example against live parameter metadata and run them in a sandbox; fix examples that did not work (CSV restore, account filter, recursive inheritance, -AccessRights typos) - Rewrite the home, concepts, examples, README, and contributor pages; add a grouped cmdlet overview, module settings, privileges, long paths, and the platyPS workflow - Document Remove-Item2 -PassThru as renamed after 4.2.6 (#64) - Fix mkdocs.yml navigation, edit_uri, and copyright markup; add build.os and a pinned MkDocs version for Read the Docs - Point online help links to the pages on GitHub; add CHANGELOG.md Co-authored-by: Copilot &lt;223556219+Copilot@users.noreply.github.com&gt; Co-authored-by: AI Assistant &lt;ai@example.com&gt; * ci: build the module and check the docs against the build The documentation check ran Update-MarkdownHelp against the NTFSSecurity release from the PowerShell Gallery (4.2.6), so it failed for every unreleased parameter change. PR #91 failed because 4.2.6 still has Remove-Item2 -PassThur while the source and the docs have -PassThru. - Build NTFSSecurity.csproj in Release on the Visual Studio 2022 image, using the .NET Framework 4.5.2 reference assemblies package instead of an installed targeting pack - Check Docs/Cmdlets against the module built from source - Pin platyPS 0.14.2 and MarkdownLinkCheck 0.2.0, and enable TLS 1.2 so the NuGet provider bootstrap works Co-authored-by: Copilot &lt;223556219+Copilot@users.noreply.github.com&gt; Co-authored-by: AI Assistant &lt;ai@example.com&gt; * chore: record the green PR 91 build in the memory bank Co-authored-by: Copilot &lt;223556219+Copilot@users.noreply.github.com&gt; Co-authored-by: AI Assistant &lt;ai@example.com&gt; --------- Co-authored-by: Copilot &lt;223556219+Copilot@users.noreply.github.com&gt; Co-authored-by: AI Assistant &lt;ai@example.com&gt;
4 weeks ago
Every path is processed on its own. When a path does not exist, the cmdlet writes a non-terminating error and continues with the next one. When reading the descriptor fails because access is denied, the cmdlet takes ownership of the item with the account of the current session, reads the descriptor, and restores the previous owner; if that fails as well, it writes a non-terminating error.
7 years ago
## EXAMPLES
Ai/docs alignment (#91) * chore: initialize the memory bank Add the canonical .memory-bank base with evidence-based project context: purpose and scope, workflows, stack and validation commands, architecture map, decisions, and the open work found while documenting the cmdlets. Co-authored-by: Copilot &lt;223556219+Copilot@users.noreply.github.com&gt; Co-authored-by: AI Assistant &lt;ai@example.com&gt; * docs: align documentation with the cmdlet source - Fill all 36 platyPS cmdlet pages from the C# source: synopsis, description, parameters, defaults, examples, inputs, outputs, and notes, including documented limitations of the current code - Check every example against live parameter metadata and run them in a sandbox; fix examples that did not work (CSV restore, account filter, recursive inheritance, -AccessRights typos) - Rewrite the home, concepts, examples, README, and contributor pages; add a grouped cmdlet overview, module settings, privileges, long paths, and the platyPS workflow - Document Remove-Item2 -PassThru as renamed after 4.2.6 (#64) - Fix mkdocs.yml navigation, edit_uri, and copyright markup; add build.os and a pinned MkDocs version for Read the Docs - Point online help links to the pages on GitHub; add CHANGELOG.md Co-authored-by: Copilot &lt;223556219+Copilot@users.noreply.github.com&gt; Co-authored-by: AI Assistant &lt;ai@example.com&gt; * ci: build the module and check the docs against the build The documentation check ran Update-MarkdownHelp against the NTFSSecurity release from the PowerShell Gallery (4.2.6), so it failed for every unreleased parameter change. PR #91 failed because 4.2.6 still has Remove-Item2 -PassThur while the source and the docs have -PassThru. - Build NTFSSecurity.csproj in Release on the Visual Studio 2022 image, using the .NET Framework 4.5.2 reference assemblies package instead of an installed targeting pack - Check Docs/Cmdlets against the module built from source - Pin platyPS 0.14.2 and MarkdownLinkCheck 0.2.0, and enable TLS 1.2 so the NuGet provider bootstrap works Co-authored-by: Copilot &lt;223556219+Copilot@users.noreply.github.com&gt; Co-authored-by: AI Assistant &lt;ai@example.com&gt; * chore: record the green PR 91 build in the memory bank Co-authored-by: Copilot &lt;223556219+Copilot@users.noreply.github.com&gt; Co-authored-by: AI Assistant &lt;ai@example.com&gt; --------- Co-authored-by: Copilot &lt;223556219+Copilot@users.noreply.github.com&gt; Co-authored-by: AI Assistant &lt;ai@example.com&gt;
4 weeks ago
### Example 1: Get the security descriptor of a folder
```PowerShell
PS C:\> Get-NTFSSecurityDescriptor -Path C:\Data
```
This command reads the security descriptor of `C:\Data` and returns it as a `FileSystemSecurity2` object.
### Example 2: Collect several changes and apply them in one write
```PowerShell
Ai/docs alignment (#91) * chore: initialize the memory bank Add the canonical .memory-bank base with evidence-based project context: purpose and scope, workflows, stack and validation commands, architecture map, decisions, and the open work found while documenting the cmdlets. Co-authored-by: Copilot &lt;223556219+Copilot@users.noreply.github.com&gt; Co-authored-by: AI Assistant &lt;ai@example.com&gt; * docs: align documentation with the cmdlet source - Fill all 36 platyPS cmdlet pages from the C# source: synopsis, description, parameters, defaults, examples, inputs, outputs, and notes, including documented limitations of the current code - Check every example against live parameter metadata and run them in a sandbox; fix examples that did not work (CSV restore, account filter, recursive inheritance, -AccessRights typos) - Rewrite the home, concepts, examples, README, and contributor pages; add a grouped cmdlet overview, module settings, privileges, long paths, and the platyPS workflow - Document Remove-Item2 -PassThru as renamed after 4.2.6 (#64) - Fix mkdocs.yml navigation, edit_uri, and copyright markup; add build.os and a pinned MkDocs version for Read the Docs - Point online help links to the pages on GitHub; add CHANGELOG.md Co-authored-by: Copilot &lt;223556219+Copilot@users.noreply.github.com&gt; Co-authored-by: AI Assistant &lt;ai@example.com&gt; * ci: build the module and check the docs against the build The documentation check ran Update-MarkdownHelp against the NTFSSecurity release from the PowerShell Gallery (4.2.6), so it failed for every unreleased parameter change. PR #91 failed because 4.2.6 still has Remove-Item2 -PassThur while the source and the docs have -PassThru. - Build NTFSSecurity.csproj in Release on the Visual Studio 2022 image, using the .NET Framework 4.5.2 reference assemblies package instead of an installed targeting pack - Check Docs/Cmdlets against the module built from source - Pin platyPS 0.14.2 and MarkdownLinkCheck 0.2.0, and enable TLS 1.2 so the NuGet provider bootstrap works Co-authored-by: Copilot &lt;223556219+Copilot@users.noreply.github.com&gt; Co-authored-by: AI Assistant &lt;ai@example.com&gt; * chore: record the green PR 91 build in the memory bank Co-authored-by: Copilot &lt;223556219+Copilot@users.noreply.github.com&gt; Co-authored-by: AI Assistant &lt;ai@example.com&gt; --------- Co-authored-by: Copilot &lt;223556219+Copilot@users.noreply.github.com&gt; Co-authored-by: AI Assistant &lt;ai@example.com&gt;
4 weeks ago
PS C:\> $sd = Get-NTFSSecurityDescriptor -Path C:\Data
PS C:\> Add-NTFSAccess -SecurityDescriptor $sd -Account 'CONTOSO\JohnDoe' -AccessRights Modify -AppliesTo ThisFolderSubfoldersAndFiles
PS C:\> Remove-NTFSAccess -SecurityDescriptor $sd -Account 'BUILTIN\Users' -AccessRights ReadAndExecute -AppliesTo ThisFolderSubfoldersAndFiles
PS C:\> Set-NTFSSecurityDescriptor -SecurityDescriptor $sd
7 years ago
```
Ai/docs alignment (#91) * chore: initialize the memory bank Add the canonical .memory-bank base with evidence-based project context: purpose and scope, workflows, stack and validation commands, architecture map, decisions, and the open work found while documenting the cmdlets. Co-authored-by: Copilot &lt;223556219+Copilot@users.noreply.github.com&gt; Co-authored-by: AI Assistant &lt;ai@example.com&gt; * docs: align documentation with the cmdlet source - Fill all 36 platyPS cmdlet pages from the C# source: synopsis, description, parameters, defaults, examples, inputs, outputs, and notes, including documented limitations of the current code - Check every example against live parameter metadata and run them in a sandbox; fix examples that did not work (CSV restore, account filter, recursive inheritance, -AccessRights typos) - Rewrite the home, concepts, examples, README, and contributor pages; add a grouped cmdlet overview, module settings, privileges, long paths, and the platyPS workflow - Document Remove-Item2 -PassThru as renamed after 4.2.6 (#64) - Fix mkdocs.yml navigation, edit_uri, and copyright markup; add build.os and a pinned MkDocs version for Read the Docs - Point online help links to the pages on GitHub; add CHANGELOG.md Co-authored-by: Copilot &lt;223556219+Copilot@users.noreply.github.com&gt; Co-authored-by: AI Assistant &lt;ai@example.com&gt; * ci: build the module and check the docs against the build The documentation check ran Update-MarkdownHelp against the NTFSSecurity release from the PowerShell Gallery (4.2.6), so it failed for every unreleased parameter change. PR #91 failed because 4.2.6 still has Remove-Item2 -PassThur while the source and the docs have -PassThru. - Build NTFSSecurity.csproj in Release on the Visual Studio 2022 image, using the .NET Framework 4.5.2 reference assemblies package instead of an installed targeting pack - Check Docs/Cmdlets against the module built from source - Pin platyPS 0.14.2 and MarkdownLinkCheck 0.2.0, and enable TLS 1.2 so the NuGet provider bootstrap works Co-authored-by: Copilot &lt;223556219+Copilot@users.noreply.github.com&gt; Co-authored-by: AI Assistant &lt;ai@example.com&gt; * chore: record the green PR 91 build in the memory bank Co-authored-by: Copilot &lt;223556219+Copilot@users.noreply.github.com&gt; Co-authored-by: AI Assistant &lt;ai@example.com&gt; --------- Co-authored-by: Copilot &lt;223556219+Copilot@users.noreply.github.com&gt; Co-authored-by: AI Assistant &lt;ai@example.com&gt;
4 weeks ago
The first three commands read the descriptor of `C:\Data` and change its access control list in memory, which leaves the folder untouched. The last command writes both changes to the folder at once.
### Example 3: Inspect the access control list of the descriptor before writing it
```PowerShell
PS C:\> $sd = Get-NTFSSecurityDescriptor -Path C:\Data
PS C:\> Add-NTFSAccess -SecurityDescriptor $sd -Account 'CONTOSO\JohnDoe' -AccessRights FullControl -AppliesTo ThisFolderOnly
PS C:\> Get-NTFSAccess -SecurityDescriptor $sd
```
The third command lists the access control entries of the descriptor in memory, which already include the permissions that were just added. Compare the result with `Get-NTFSAccess -Path C:\Data` to see that the folder itself has not changed yet.
### Example 4: Get the security descriptor of the current location
```PowerShell
PS C:\> Set-Location -Path C:\Data
PS C:\Data> Get-NTFSSecurityDescriptor
```
Without `-Path`, the cmdlet returns the security descriptor of the current location.
7 years ago
## PARAMETERS
### -Path
Ai/docs alignment (#91) * chore: initialize the memory bank Add the canonical .memory-bank base with evidence-based project context: purpose and scope, workflows, stack and validation commands, architecture map, decisions, and the open work found while documenting the cmdlets. Co-authored-by: Copilot &lt;223556219+Copilot@users.noreply.github.com&gt; Co-authored-by: AI Assistant &lt;ai@example.com&gt; * docs: align documentation with the cmdlet source - Fill all 36 platyPS cmdlet pages from the C# source: synopsis, description, parameters, defaults, examples, inputs, outputs, and notes, including documented limitations of the current code - Check every example against live parameter metadata and run them in a sandbox; fix examples that did not work (CSV restore, account filter, recursive inheritance, -AccessRights typos) - Rewrite the home, concepts, examples, README, and contributor pages; add a grouped cmdlet overview, module settings, privileges, long paths, and the platyPS workflow - Document Remove-Item2 -PassThru as renamed after 4.2.6 (#64) - Fix mkdocs.yml navigation, edit_uri, and copyright markup; add build.os and a pinned MkDocs version for Read the Docs - Point online help links to the pages on GitHub; add CHANGELOG.md Co-authored-by: Copilot &lt;223556219+Copilot@users.noreply.github.com&gt; Co-authored-by: AI Assistant &lt;ai@example.com&gt; * ci: build the module and check the docs against the build The documentation check ran Update-MarkdownHelp against the NTFSSecurity release from the PowerShell Gallery (4.2.6), so it failed for every unreleased parameter change. PR #91 failed because 4.2.6 still has Remove-Item2 -PassThur while the source and the docs have -PassThru. - Build NTFSSecurity.csproj in Release on the Visual Studio 2022 image, using the .NET Framework 4.5.2 reference assemblies package instead of an installed targeting pack - Check Docs/Cmdlets against the module built from source - Pin platyPS 0.14.2 and MarkdownLinkCheck 0.2.0, and enable TLS 1.2 so the NuGet provider bootstrap works Co-authored-by: Copilot &lt;223556219+Copilot@users.noreply.github.com&gt; Co-authored-by: AI Assistant &lt;ai@example.com&gt; * chore: record the green PR 91 build in the memory bank Co-authored-by: Copilot &lt;223556219+Copilot@users.noreply.github.com&gt; Co-authored-by: AI Assistant &lt;ai@example.com&gt; --------- Co-authored-by: Copilot &lt;223556219+Copilot@users.noreply.github.com&gt; Co-authored-by: AI Assistant &lt;ai@example.com&gt;
4 weeks ago
Specifies the path of one or more files or folders whose security descriptor you want to read. Relative paths are resolved against the current location. When you omit this parameter, the cmdlet uses the current location.
7 years ago
```yaml
Type: String[]
Parameter Sets: (All)
Aliases: FullName
Required: False
Position: 1
Default value: None
Accept pipeline input: True (ByPropertyName, ByValue)
Accept wildcard characters: False
```
### CommonParameters
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).
## INPUTS
### System.String[]
Ai/docs alignment (#91) * chore: initialize the memory bank Add the canonical .memory-bank base with evidence-based project context: purpose and scope, workflows, stack and validation commands, architecture map, decisions, and the open work found while documenting the cmdlets. Co-authored-by: Copilot &lt;223556219+Copilot@users.noreply.github.com&gt; Co-authored-by: AI Assistant &lt;ai@example.com&gt; * docs: align documentation with the cmdlet source - Fill all 36 platyPS cmdlet pages from the C# source: synopsis, description, parameters, defaults, examples, inputs, outputs, and notes, including documented limitations of the current code - Check every example against live parameter metadata and run them in a sandbox; fix examples that did not work (CSV restore, account filter, recursive inheritance, -AccessRights typos) - Rewrite the home, concepts, examples, README, and contributor pages; add a grouped cmdlet overview, module settings, privileges, long paths, and the platyPS workflow - Document Remove-Item2 -PassThru as renamed after 4.2.6 (#64) - Fix mkdocs.yml navigation, edit_uri, and copyright markup; add build.os and a pinned MkDocs version for Read the Docs - Point online help links to the pages on GitHub; add CHANGELOG.md Co-authored-by: Copilot &lt;223556219+Copilot@users.noreply.github.com&gt; Co-authored-by: AI Assistant &lt;ai@example.com&gt; * ci: build the module and check the docs against the build The documentation check ran Update-MarkdownHelp against the NTFSSecurity release from the PowerShell Gallery (4.2.6), so it failed for every unreleased parameter change. PR #91 failed because 4.2.6 still has Remove-Item2 -PassThur while the source and the docs have -PassThru. - Build NTFSSecurity.csproj in Release on the Visual Studio 2022 image, using the .NET Framework 4.5.2 reference assemblies package instead of an installed targeting pack - Check Docs/Cmdlets against the module built from source - Pin platyPS 0.14.2 and MarkdownLinkCheck 0.2.0, and enable TLS 1.2 so the NuGet provider bootstrap works Co-authored-by: Copilot &lt;223556219+Copilot@users.noreply.github.com&gt; Co-authored-by: AI Assistant &lt;ai@example.com&gt; * chore: record the green PR 91 build in the memory bank Co-authored-by: Copilot &lt;223556219+Copilot@users.noreply.github.com&gt; Co-authored-by: AI Assistant &lt;ai@example.com&gt; --------- Co-authored-by: Copilot &lt;223556219+Copilot@users.noreply.github.com&gt; Co-authored-by: AI Assistant &lt;ai@example.com&gt;
4 weeks ago
You can pipe one or more paths to this cmdlet. Objects that expose a `Path` or `FullName` property, such as the output of `Get-ChildItem2` and `Get-Item2`, bind to `-Path` as well.
7 years ago
## OUTPUTS
### Security2.FileSystemSecurity2
Ai/docs alignment (#91) * chore: initialize the memory bank Add the canonical .memory-bank base with evidence-based project context: purpose and scope, workflows, stack and validation commands, architecture map, decisions, and the open work found while documenting the cmdlets. Co-authored-by: Copilot &lt;223556219+Copilot@users.noreply.github.com&gt; Co-authored-by: AI Assistant &lt;ai@example.com&gt; * docs: align documentation with the cmdlet source - Fill all 36 platyPS cmdlet pages from the C# source: synopsis, description, parameters, defaults, examples, inputs, outputs, and notes, including documented limitations of the current code - Check every example against live parameter metadata and run them in a sandbox; fix examples that did not work (CSV restore, account filter, recursive inheritance, -AccessRights typos) - Rewrite the home, concepts, examples, README, and contributor pages; add a grouped cmdlet overview, module settings, privileges, long paths, and the platyPS workflow - Document Remove-Item2 -PassThru as renamed after 4.2.6 (#64) - Fix mkdocs.yml navigation, edit_uri, and copyright markup; add build.os and a pinned MkDocs version for Read the Docs - Point online help links to the pages on GitHub; add CHANGELOG.md Co-authored-by: Copilot &lt;223556219+Copilot@users.noreply.github.com&gt; Co-authored-by: AI Assistant &lt;ai@example.com&gt; * ci: build the module and check the docs against the build The documentation check ran Update-MarkdownHelp against the NTFSSecurity release from the PowerShell Gallery (4.2.6), so it failed for every unreleased parameter change. PR #91 failed because 4.2.6 still has Remove-Item2 -PassThur while the source and the docs have -PassThru. - Build NTFSSecurity.csproj in Release on the Visual Studio 2022 image, using the .NET Framework 4.5.2 reference assemblies package instead of an installed targeting pack - Check Docs/Cmdlets against the module built from source - Pin platyPS 0.14.2 and MarkdownLinkCheck 0.2.0, and enable TLS 1.2 so the NuGet provider bootstrap works Co-authored-by: Copilot &lt;223556219+Copilot@users.noreply.github.com&gt; Co-authored-by: AI Assistant &lt;ai@example.com&gt; * chore: record the green PR 91 build in the memory bank Co-authored-by: Copilot &lt;223556219+Copilot@users.noreply.github.com&gt; Co-authored-by: AI Assistant &lt;ai@example.com&gt; --------- Co-authored-by: Copilot &lt;223556219+Copilot@users.noreply.github.com&gt; Co-authored-by: AI Assistant &lt;ai@example.com&gt;
4 weeks ago
The cmdlet returns one object per item. It wraps the item in `Item` and the underlying `System.Security.AccessControl.FileSecurity` or `DirectorySecurity` object in `SecurityDescriptor`, and it exposes the path in `FullName`, the item name in `Name`, and whether the item is a file in `IsFile`.
7 years ago
## NOTES
Ai/docs alignment (#91) * chore: initialize the memory bank Add the canonical .memory-bank base with evidence-based project context: purpose and scope, workflows, stack and validation commands, architecture map, decisions, and the open work found while documenting the cmdlets. Co-authored-by: Copilot &lt;223556219+Copilot@users.noreply.github.com&gt; Co-authored-by: AI Assistant &lt;ai@example.com&gt; * docs: align documentation with the cmdlet source - Fill all 36 platyPS cmdlet pages from the C# source: synopsis, description, parameters, defaults, examples, inputs, outputs, and notes, including documented limitations of the current code - Check every example against live parameter metadata and run them in a sandbox; fix examples that did not work (CSV restore, account filter, recursive inheritance, -AccessRights typos) - Rewrite the home, concepts, examples, README, and contributor pages; add a grouped cmdlet overview, module settings, privileges, long paths, and the platyPS workflow - Document Remove-Item2 -PassThru as renamed after 4.2.6 (#64) - Fix mkdocs.yml navigation, edit_uri, and copyright markup; add build.os and a pinned MkDocs version for Read the Docs - Point online help links to the pages on GitHub; add CHANGELOG.md Co-authored-by: Copilot &lt;223556219+Copilot@users.noreply.github.com&gt; Co-authored-by: AI Assistant &lt;ai@example.com&gt; * ci: build the module and check the docs against the build The documentation check ran Update-MarkdownHelp against the NTFSSecurity release from the PowerShell Gallery (4.2.6), so it failed for every unreleased parameter change. PR #91 failed because 4.2.6 still has Remove-Item2 -PassThur while the source and the docs have -PassThru. - Build NTFSSecurity.csproj in Release on the Visual Studio 2022 image, using the .NET Framework 4.5.2 reference assemblies package instead of an installed targeting pack - Check Docs/Cmdlets against the module built from source - Pin platyPS 0.14.2 and MarkdownLinkCheck 0.2.0, and enable TLS 1.2 so the NuGet provider bootstrap works Co-authored-by: Copilot &lt;223556219+Copilot@users.noreply.github.com&gt; Co-authored-by: AI Assistant &lt;ai@example.com&gt; * chore: record the green PR 91 build in the memory bank Co-authored-by: Copilot &lt;223556219+Copilot@users.noreply.github.com&gt; Co-authored-by: AI Assistant &lt;ai@example.com&gt; --------- Co-authored-by: Copilot &lt;223556219+Copilot@users.noreply.github.com&gt; Co-authored-by: AI Assistant &lt;ai@example.com&gt;
4 weeks ago
When the module setting `EnablePrivileges` is `$true` (the default in the `PrivateData` section of NTFSSecurity.psd1), this cmdlet tries to enable the Backup, Restore, Take Ownership, and Security privileges while it runs and disables the privileges it enabled when it finishes. These privileges are only available in an elevated session of an account that holds them, such as a member of the local Administrators group. If a privilege cannot be enabled, the cmdlet continues without it and writes a debug message.
`Add-NTFSAccess`, `Remove-NTFSAccess`, `Add-NTFSAudit`, and `Remove-NTFSAudit` offer two parameter sets for a security descriptor, one with `-AppliesTo` and one with `-InheritanceFlags` and `-PropagationFlags`. Specify at least one of those parameters when you pass a descriptor to them; otherwise PowerShell cannot decide which parameter set to use and reports an ambiguous parameter set.
7 years ago
## RELATED LINKS
Ai/docs alignment (#91) * chore: initialize the memory bank Add the canonical .memory-bank base with evidence-based project context: purpose and scope, workflows, stack and validation commands, architecture map, decisions, and the open work found while documenting the cmdlets. Co-authored-by: Copilot &lt;223556219+Copilot@users.noreply.github.com&gt; Co-authored-by: AI Assistant &lt;ai@example.com&gt; * docs: align documentation with the cmdlet source - Fill all 36 platyPS cmdlet pages from the C# source: synopsis, description, parameters, defaults, examples, inputs, outputs, and notes, including documented limitations of the current code - Check every example against live parameter metadata and run them in a sandbox; fix examples that did not work (CSV restore, account filter, recursive inheritance, -AccessRights typos) - Rewrite the home, concepts, examples, README, and contributor pages; add a grouped cmdlet overview, module settings, privileges, long paths, and the platyPS workflow - Document Remove-Item2 -PassThru as renamed after 4.2.6 (#64) - Fix mkdocs.yml navigation, edit_uri, and copyright markup; add build.os and a pinned MkDocs version for Read the Docs - Point online help links to the pages on GitHub; add CHANGELOG.md Co-authored-by: Copilot &lt;223556219+Copilot@users.noreply.github.com&gt; Co-authored-by: AI Assistant &lt;ai@example.com&gt; * ci: build the module and check the docs against the build The documentation check ran Update-MarkdownHelp against the NTFSSecurity release from the PowerShell Gallery (4.2.6), so it failed for every unreleased parameter change. PR #91 failed because 4.2.6 still has Remove-Item2 -PassThur while the source and the docs have -PassThru. - Build NTFSSecurity.csproj in Release on the Visual Studio 2022 image, using the .NET Framework 4.5.2 reference assemblies package instead of an installed targeting pack - Check Docs/Cmdlets against the module built from source - Pin platyPS 0.14.2 and MarkdownLinkCheck 0.2.0, and enable TLS 1.2 so the NuGet provider bootstrap works Co-authored-by: Copilot &lt;223556219+Copilot@users.noreply.github.com&gt; Co-authored-by: AI Assistant &lt;ai@example.com&gt; * chore: record the green PR 91 build in the memory bank Co-authored-by: Copilot &lt;223556219+Copilot@users.noreply.github.com&gt; Co-authored-by: AI Assistant &lt;ai@example.com&gt; --------- Co-authored-by: Copilot &lt;223556219+Copilot@users.noreply.github.com&gt; Co-authored-by: AI Assistant &lt;ai@example.com&gt;
4 weeks ago
[Set-NTFSSecurityDescriptor](Set-NTFSSecurityDescriptor.md)
[Get-NTFSAccess](Get-NTFSAccess.md)
[Add-NTFSAccess](Add-NTFSAccess.md)
[Get-NTFSOwner](Get-NTFSOwner.md)
[Get-NTFSInheritance](Get-NTFSInheritance.md)