Skip to content

New-Item -ItemType Junction checks for invalid parameter (Target) #19849

@gaiking-uk

Description

@gaiking-uk

Prerequisites

Steps to reproduce

New-Item parameter set / parameter checking gives an incorrect error message when trying to create a junction... It specifies that a Target parameter is needed, however there is no parameter called Target.

I raised this initially as a documentation issue #10199, but @sdwheeler advised that this is a bug as there is no parameter called Target, and actually Target is an alias for Value

Expected behavior

$JuncName = "Foo"
$JuncTarget = "D:\Junction_Target"
> New-Item -ItemType Junction -Name $JuncName -Path $JuncTarget

Junction created successfully.

Actual behavior

$JuncName = "Foo"
$JuncTarget = "D:\Junction_Target"
> New-Item -ItemType Junction -Name $JuncName -Path $JuncTarget

ERROR: Link "D:\Junction_Target" cannot be created because Target was not specified.

Error details

Link cannot be created because Target was not specified.

Environment data

> $PSVersionTable
Name                           Value
GitCommitId                    7.3.4
OS                             Microsoft Windows 10.0.22621
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Visuals

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions