Skip to content

Include Junction and HardLink in New-Item type error message#27258

Open
badgerbees wants to merge 1 commit intoPowerShell:masterfrom
badgerbees:fix/new-item-known-types-message
Open

Include Junction and HardLink in New-Item type error message#27258
badgerbees wants to merge 1 commit intoPowerShell:masterfrom
badgerbees:fix/new-item-known-types-message

Conversation

@badgerbees
Copy link
Copy Markdown

@badgerbees badgerbees commented Apr 11, 2026

PR Summary

This PR updates the file-system provider's unknown item-type error to include junction and hardlink, and adds a regression test that locks the full supported type list. This also fixes issue #27248.

PR Context

New-Item -Type already accepts File, Directory, SymbolicLink, Junction, and HardLink. The existing error message was stale and only listed the first three values, so this change keeps the message aligned with the actual implementation and prevents the list from drifting again.

I verified the compiled System.Management.Automation.dll contains the updated resource string, and I ran the focused New-Item.Tests.ps1 Pester file against the built output.

PR Checklist

@badgerbees badgerbees requested a review from a team as a code owner April 11, 2026 11:31
Copilot AI review requested due to automatic review settings April 11, 2026 11:31
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the FileSystem provider’s New-Item -Type “unknown type” error text to reflect all documented supported item types, and adds a regression test to prevent the message from drifting from implementation again.

Changes:

  • Update FileSystemProviderStrings.UnknownType to include junction and hardlink in the supported type list.
  • Add a Pester regression test asserting the exact error id and message for an unsupported -Type value.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
test/powershell/Modules/Microsoft.PowerShell.Management/New-Item.Tests.ps1 Adds a regression test validating the unknown -Type error id and supported-type message text.
src/System.Management.Automation/resources/FileSystemProviderStrings.resx Updates the UnknownType resource string to include junction and hardlink.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants