Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2449,8 +2449,9 @@ private static bool WinCreateSymbolicLink(string path, string strTargetPath, boo
{
// The new AllowUnprivilegedCreate is only available on Win10 build 14972 or newer
var flags = isDirectory ? NativeMethods.SymbolicLinkFlags.Directory : NativeMethods.SymbolicLinkFlags.File;
if (Environment.OSVersion.Version.Major == 10 && Environment.OSVersion.Version.Build >= 14972 ||
Environment.OSVersion.Version.Major >= 11)

Version minBuildOfDeveloperMode = new Version(10, 0, 14972, 0);
if (Environment.OSVersion.Version >= minBuildOfDeveloperMode)
{
flags |= NativeMethods.SymbolicLinkFlags.AllowUnprivilegedCreate;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,9 @@ Describe "New-Item with links fails for non elevated user if developer mode not
$testlink = "testlink"
$FullyQualifiedFile = Join-Path -Path $TestDrive -ChildPath $testfile
$TestFilePath = Join-Path -Path $TestDrive -ChildPath $testlink
$developerMode = (Get-ItemProperty HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\AppModelUnlock -ErrorAction SilentlyContinue).AllowDevelopmentWithoutDevLicense -eq 1
$developerModeEnabled = (Get-ItemProperty HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\AppModelUnlock -ErrorAction SilentlyContinue).AllowDevelopmentWithoutDevLicense -eq 1
$minBuildRequired = [System.Environment]::OSVersion.Version -ge "10.0.14972"
$developerMode = $developerModeEnabled -and $minBuildRequired
}

AfterEach {
Expand Down