Improve check for developer mode by checking minimum required build number (#8749)

* Improve check for developer mode by checking minimum required build number

The test would fail if the developer mode is enabled but the machine has an older build than the minimum required build.
The change adds a check for the build version in the test.

* Update test/powershell/Modules/Microsoft.PowerShell.Management/New-Item.Tests.ps1
This commit is contained in:
Aditya Patwardhan authored and Travis Plunk committed 2019-01-25 13:14:29 -08:00
1 parent 12547c01e8
commit 6ccbebda27
2 files changed
+6 -3

No files matched your search

@@ -2449,8 +2449,9 @@ namespace Microsoft.PowerShell.Commands
{
// 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;
}