Skip to content

Leverage new API for creating symlink without administrator privileges on Windows #2845

Closed

Description

Just saw this get posted today: https://blogs.windows.com/buildingapps/2016/12/02/symlinks-windows-10/

We should opt-in to this API so that we're uniform across all platforms in allowing non-admins to create links.

Steps to reproduce

Try to create a symlink as a non-admin. You'll get a permission denied.

Expected behavior

(as non-admin)

PS C:\temp> New-Item -type SymbolicLink -Path link -Value source

    Directory: C:\temp
Mode                LastWriteTime         Length Name
----                -------------         ------ ----
-a---l        12/5/2016   6:39 PM              0 link

Actual behavior

PS C:\temp> New-Item -type SymbolicLink -Path link -Value source
New-Item : Administrator privilege required for this operation.
At line:1 char:1
+ New-Item -type SymbolicLink -Path link -Value source
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : PermissionDenied: (C:\temp\source:String) [New-Item], UnauthorizedAccessException
    + FullyQualifiedErrorId : NewItemSymbolicLinkElevationRequired,Microsoft.PowerShell.Commands.NewItemCommand

Environment data

All versions of Windows PowerShell 5.x and PowerShell Core 6.0.

Activity

  1. iSazonov commented on Dec 6, 2016

    @iSazonov
    Collaborator

    Will the API be ported on Windows 7/8?

  2. andyleejordan commented on Jun 19, 2017

    @andyleejordan
    Member

    Ilya (@iSazonov) no, and what's more, adding the flag to builds < 14972 will cause an invalid parameter error (according to this thread). That said, the flag can be conditionally added after checking the current build.

  3. dilijev commented on Jul 6, 2018

    @dilijev

    This issue still repros in RS4 build 17134

  4. yhvicey commented on Dec 24, 2018

    @yhvicey

    It's already two years after the feature is released. Is there any update on this feature?

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

Metadata

Metadata

Labels

OS-WindowsResolution-FixedWG-Cmdlets

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions