Browse Source

feat!: prepare version 5.0.0 with a valid module manifest

- Require Windows PowerShell 5.1 or PowerShell 7 (PowerShellVersion
  5.1, which CompatiblePSEditions needs) and .NET Framework 4.5.2, and
  use RootModule instead of the deprecated ModuleToProcess. Before,
  Test-ModuleManifest, and with it Publish-Module, failed.
- Export exactly the 36 cmdlets: remove Show-NTFSSimpleAccess, which no
  longer exists, and the duplicate inheritance cmdlets.
- Keep -PassThur, the name in 4.2.6 and earlier, as an alias of
  Remove-Item2 -PassThru, deprecated in the changelog.
- Set version 5.0.0 in the manifest, in NTFSSecurity, Security2, and
  PrivilegeControl, and in a new 5.0.0 section of CHANGELOG.md.
- Tests/Manifest.Tests.ps1 and Tests/Remove-Item2.Tests.ps1 guard the
  manifest, the versions, and the alias.

BREAKING CHANGE: the module requires Windows PowerShell 5.1 or
PowerShell 7; the manifest no longer claims PowerShell 2.0.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: AI Assistant <ai@example.com>
pull/95/head
Raimund Andree 1 week ago
parent
commit
678ff90db7
  1. 24
      CHANGELOG.md
  2. 4
      Docs/Cmdlets/Remove-Item2.md
  3. 2
      NTFSSecurity/ItemCmdlets/RemoveItem2.cs
  4. 13
      NTFSSecurity/NTFSSecurity.psd1
  5. 4
      NTFSSecurity/Properties/AssemblyInfo.cs
  6. 8
      NTFSSecurity/en-US/NTFSSecurity.dll-Help.xml
  7. 4
      PrivilegeControl/Properties/AssemblyInfo.cs
  8. 4
      Security2/Properties/AssemblyInfo.cs
  9. 73
      Tests/Manifest.Tests.ps1
  10. 35
      Tests/Remove-Item2.Tests.ps1

24
CHANGELOG.md

@ -8,12 +8,18 @@ The format is based on
## [Unreleased] ## [Unreleased]
## [5.0.0] - 2026-10-04
### Changed ### Changed
- **Breaking:** rename the `-PassThur` parameter of `Remove-Item2` to - **Breaking:** require Windows PowerShell 5.1 or PowerShell 7, and declare
`-PassThru` ([#64](https://github.com/raandree/NTFSSecurity/pull/64)) support for both editions in the module manifest
- Declare support for Windows PowerShell and PowerShell 7 in the module ([#61](https://github.com/raandree/NTFSSecurity/issues/61)); the manifest
manifest ([#61](https://github.com/raandree/NTFSSecurity/issues/61)) declared PowerShell 2.0 and .NET Framework 3.5, although the module needs
.NET Framework 4.5.2
- Rename the `-PassThur` parameter of `Remove-Item2` to `-PassThru`;
`-PassThur` still works as an alias
([#64](https://github.com/raandree/NTFSSecurity/pull/64))
- Document every cmdlet with synopsis, description, parameters, examples, - Document every cmdlet with synopsis, description, parameters, examples,
inputs, outputs, and notes, checked against the source code inputs, outputs, and notes, checked against the source code
- Rewrite the home, concepts, examples, and contributor pages to match the - Rewrite the home, concepts, examples, and contributor pages to match the
@ -21,6 +27,10 @@ The format is based on
- Move the version history and the installation instructions from the wiki - Move the version history and the installation instructions from the wiki
into the documentation, and add the missing notes for 4.2.5 and 4.2.6 into the documentation, and add the missing notes for 4.2.5 and 4.2.6
### Deprecated
- Deprecate the `-PassThur` alias of `Remove-Item2`; use `-PassThru`
### Fixed ### Fixed
- Fix `Get-Help`, which showed only the syntax: ship the help file - Fix `Get-Help`, which showed only the syntax: ship the help file
@ -29,5 +39,9 @@ The format is based on
`NTFSSecurity-Help.xml` `NTFSSecurity-Help.xml`
- Fix documentation examples that did not work, such as restoring - Fix documentation examples that did not work, such as restoring
permissions from a CSV file and filtering entries by account permissions from a CSV file and filtering entries by account
- Remove `Show-NTFSSimpleAccess`, which no longer exists, and duplicate
entries from the cmdlets that the module manifest exports and the
PowerShell Gallery lists
[Unreleased]: https://github.com/raandree/NTFSSecurity/compare/4.2.6...HEAD [Unreleased]: https://github.com/raandree/NTFSSecurity/compare/5.0.0...HEAD
[5.0.0]: https://github.com/raandree/NTFSSecurity/compare/4.2.6...5.0.0

4
Docs/Cmdlets/Remove-Item2.md

@ -95,12 +95,12 @@ Accept wildcard characters: False
### -PassThru ### -PassThru
Indicates that the cmdlet returns an object for each item that it deleted. By default, the cmdlet produces no output. The object describes a path that no longer exists, so use it for logging rather than for further file operations. In NTFSSecurity 4.2.6 and earlier, this parameter is spelled `-PassThur`. Indicates that the cmdlet returns an object for each item that it deleted. By default, the cmdlet produces no output. The object describes a path that no longer exists, so use it for logging rather than for further file operations. `-PassThur`, the name of this parameter in NTFSSecurity 4.2.6 and earlier, still works as an alias.
```yaml ```yaml
Type: SwitchParameter Type: SwitchParameter
Parameter Sets: (All) Parameter Sets: (All)
Aliases: Aliases: PassThur
Required: False Required: False
Position: Named Position: Named

2
NTFSSecurity/ItemCmdlets/RemoveItem2.cs

@ -39,7 +39,9 @@ namespace NTFSSecurity
set { recurse = value; } set { recurse = value; }
} }
// -PassThur is the parameter name in 4.2.6 and earlier.
[Parameter] [Parameter]
[Alias("PassThur")]
public SwitchParameter PassThru public SwitchParameter PassThru
{ {
get { return passThru; } get { return passThru; }

13
NTFSSecurity/NTFSSecurity.psd1

@ -1,7 +1,7 @@
@{ @{
ModuleToProcess = 'NTFSSecurity.psm1' RootModule = 'NTFSSecurity.psm1'
ModuleVersion = '4.2.5' ModuleVersion = '5.0.0'
GUID = 'cd303a6c-f405-4dcb-b1ce-fbc2c52264e9' GUID = 'cd303a6c-f405-4dcb-b1ce-fbc2c52264e9'
@ -13,11 +13,11 @@
Description = 'Windows PowerShell Module for managing file and folder security on NTFS volumes' Description = 'Windows PowerShell Module for managing file and folder security on NTFS volumes'
PowerShellVersion = '2.0' PowerShellVersion = '5.1'
CompatiblePSEditions = 'Core', 'Desktop' CompatiblePSEditions = 'Core', 'Desktop'
DotNetFrameworkVersion = '3.5' DotNetFrameworkVersion = '4.5.2'
ScriptsToProcess = @('NTFSSecurity.Init.ps1') ScriptsToProcess = @('NTFSSecurity.Init.ps1')
@ -31,19 +31,14 @@
CmdletsToExport = 'Add-NTFSAccess', CmdletsToExport = 'Add-NTFSAccess',
'Clear-NTFSAccess', 'Clear-NTFSAccess',
'Disable-NTFSAccessInheritance',
'Enable-NTFSAccessInheritance',
'Get-NTFSAccess', 'Get-NTFSAccess',
'Get-NTFSEffectiveAccess', 'Get-NTFSEffectiveAccess',
'Get-NTFSOrphanedAccess', 'Get-NTFSOrphanedAccess',
'Get-NTFSSimpleAccess', 'Get-NTFSSimpleAccess',
'Remove-NTFSAccess', 'Remove-NTFSAccess',
'Show-NTFSSimpleAccess',
#---------------------------------------------- #----------------------------------------------
'Add-NTFSAudit', 'Add-NTFSAudit',
'Clear-NTFSAudit', 'Clear-NTFSAudit',
'Disable-NTFSAuditInheritance',
'Enable-NTFSAuditInheritance',
'Get-NTFSAudit', 'Get-NTFSAudit',
'Get-NTFSOrphanedAudit', 'Get-NTFSOrphanedAudit',
'Remove-NTFSAudit', 'Remove-NTFSAudit',

4
NTFSSecurity/Properties/AssemblyInfo.cs

@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers // You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below: // by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")] // [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("4.2.1.0")] [assembly: AssemblyVersion("5.0.0.0")]
[assembly: AssemblyFileVersion("4.2.1.0")] [assembly: AssemblyFileVersion("5.0.0.0")]

8
NTFSSecurity/en-US/NTFSSecurity.dll-Help.xml

@ -7400,10 +7400,10 @@ PS C:\Data&gt; Get-NTFSSecurityDescriptor</dev:code>
</dev:type> </dev:type>
<dev:defaultValue>False</dev:defaultValue> <dev:defaultValue>False</dev:defaultValue>
</command:parameter> </command:parameter>
<command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="PassThur">
<maml:name>PassThru</maml:name> <maml:name>PassThru</maml:name>
<maml:description> <maml:description>
<maml:para>Indicates that the cmdlet returns an object for each item that it deleted. By default, the cmdlet produces no output. The object describes a path that no longer exists, so use it for logging rather than for further file operations. In NTFSSecurity 4.2.6 and earlier, this parameter is spelled `-PassThur`.</maml:para> <maml:para>Indicates that the cmdlet returns an object for each item that it deleted. By default, the cmdlet produces no output. The object describes a path that no longer exists, so use it for logging rather than for further file operations. `-PassThur`, the name of this parameter in NTFSSecurity 4.2.6 and earlier, still works as an alias.</maml:para>
</maml:description> </maml:description>
<dev:type> <dev:type>
<maml:name>SwitchParameter</maml:name> <maml:name>SwitchParameter</maml:name>
@ -7460,10 +7460,10 @@ PS C:\Data&gt; Get-NTFSSecurityDescriptor</dev:code>
</dev:type> </dev:type>
<dev:defaultValue>False</dev:defaultValue> <dev:defaultValue>False</dev:defaultValue>
</command:parameter> </command:parameter>
<command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="PassThur">
<maml:name>PassThru</maml:name> <maml:name>PassThru</maml:name>
<maml:description> <maml:description>
<maml:para>Indicates that the cmdlet returns an object for each item that it deleted. By default, the cmdlet produces no output. The object describes a path that no longer exists, so use it for logging rather than for further file operations. In NTFSSecurity 4.2.6 and earlier, this parameter is spelled `-PassThur`.</maml:para> <maml:para>Indicates that the cmdlet returns an object for each item that it deleted. By default, the cmdlet produces no output. The object describes a path that no longer exists, so use it for logging rather than for further file operations. `-PassThur`, the name of this parameter in NTFSSecurity 4.2.6 and earlier, still works as an alias.</maml:para>
</maml:description> </maml:description>
<command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue>
<dev:type> <dev:type>

4
PrivilegeControl/Properties/AssemblyInfo.cs

@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers // You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below: // by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")] // [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyVersion("5.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyFileVersion("5.0.0.0")]

4
Security2/Properties/AssemblyInfo.cs

@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers // You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below: // by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")] // [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("3.2.3.0")] [assembly: AssemblyVersion("5.0.0.0")]
[assembly: AssemblyFileVersion("3.2.3.0")] [assembly: AssemblyFileVersion("5.0.0.0")]

73
Tests/Manifest.Tests.ps1

@ -0,0 +1,73 @@
<#
Tests the module manifest of the module built in NTFSSecurity\bin\Release: it passes Test-ModuleManifest,
exports exactly the cmdlets of the module, and carries the same version as the assemblies and CHANGELOG.md.
#>
[Diagnostics.CodeAnalysis.SuppressMessageAttribute(
'PSUseDeclaredVarsMoreThanAssignments', '', Justification = 'Pester shares variables between blocks.'
)]
param ()
BeforeDiscovery {
# The first-party assemblies of the module carry the module version; ProcessPrivileges is a vendored library.
$versionedAssemblies = 'NTFSSecurity', 'Security2', 'PrivilegeControl'
}
Describe 'Module manifest of NTFSSecurity' {
BeforeAll {
$manifestPath = Join-Path -Path $PSScriptRoot -ChildPath '..\NTFSSecurity\bin\Release\NTFSSecurity.psd1'
$manifest = Import-PowerShellDataFile -Path $manifestPath
$module = Import-Module -Name $manifestPath -Force -PassThru -ErrorAction Stop |
Where-Object -Property Name -EQ -Value 'NTFSSecurity'
}
AfterAll {
Remove-Module -Name NTFSSecurity -Force -ErrorAction SilentlyContinue
}
It 'Should pass Test-ModuleManifest without errors or warnings' {
$testParameters = @{
Path = $manifestPath
ErrorVariable = 'manifestErrors'
WarningVariable = 'manifestWarnings'
ErrorAction = 'SilentlyContinue'
WarningAction = 'SilentlyContinue'
}
$null = Test-ModuleManifest @testParameters
@($manifestErrors) + @($manifestWarnings) | ForEach-Object -Process { "$_" } | Should -BeNullOrEmpty
}
It 'Should list each cmdlet only once in CmdletsToExport' {
$duplicates = $manifest.CmdletsToExport | Group-Object | Where-Object -Property Count -GT -Value 1
$duplicates.Name | Should -BeNullOrEmpty
}
It 'Should list only cmdlets of the module in CmdletsToExport' {
$manifest.CmdletsToExport | Where-Object -FilterScript { -not $module.ExportedCmdlets.ContainsKey($_) } |
Should -BeNullOrEmpty
}
It 'Should export exactly 36 cmdlets' {
@($manifest.CmdletsToExport) | Should -HaveCount 36
$module.ExportedCmdlets.Keys | Should -HaveCount 36
}
Context 'Version' {
It 'Should give <_>.dll the module version' -ForEach $versionedAssemblies {
$assemblyPath = Join-Path -Path $module.ModuleBase -ChildPath "$_.dll"
$assemblyVersion = [Reflection.AssemblyName]::GetAssemblyName($assemblyPath).Version
$fileVersion = [version] (Get-Item -LiteralPath $assemblyPath).VersionInfo.FileVersion
$assemblyVersion.ToString(3) | Should -BeExactly $manifest.ModuleVersion
$fileVersion.ToString(3) | Should -BeExactly $manifest.ModuleVersion
}
It 'Should describe the module version in the latest section of CHANGELOG.md' {
$changelog = Get-Content -LiteralPath (Join-Path -Path $PSScriptRoot -ChildPath '..\CHANGELOG.md') -Raw
$latestVersion = [regex]::Match($changelog, '(?m)^## \[(?<Version>\d+\.\d+\.\d+)\]').Groups['Version'].Value
$latestVersion | Should -BeExactly $manifest.ModuleVersion
}
}
}

35
Tests/Remove-Item2.Tests.ps1

@ -0,0 +1,35 @@
<#
Tests Remove-Item2 of the module built in NTFSSecurity\bin\Release.
#>
[Diagnostics.CodeAnalysis.SuppressMessageAttribute(
'PSUseDeclaredVarsMoreThanAssignments', '', Justification = 'Pester shares variables between blocks.'
)]
param ()
Describe 'Remove-Item2' {
BeforeAll {
$modulePath = Join-Path -Path $PSScriptRoot -ChildPath '..\NTFSSecurity\bin\Release\NTFSSecurity.psd1'
Import-Module -Name $modulePath -Force -ErrorAction Stop
}
AfterAll {
Remove-Module -Name NTFSSecurity -Force -ErrorAction SilentlyContinue
}
Context 'When called with -PassThur, the parameter name in 4.2.6 and earlier' {
BeforeAll {
$path = Join-Path -Path $TestDrive -ChildPath 'PassThur.txt'
Set-Content -LiteralPath $path -Value 'Remove-Item2 test'
$removedItem = Remove-Item2 -Path $path -PassThur
}
It 'Should delete the file' {
$path | Should -Not -Exist
}
It 'Should return the deleted file, like -PassThru' {
$removedItem.Name | Should -BeExactly 'PassThur.txt'
}
}
}
Loading…
Cancel
Save