diff --git a/src/System.Management.Automation/CoreCLR/CorePsPlatform.cs b/src/System.Management.Automation/CoreCLR/CorePsPlatform.cs index f560517169..35ba1a55ec 100644 --- a/src/System.Management.Automation/CoreCLR/CorePsPlatform.cs +++ b/src/System.Management.Automation/CoreCLR/CorePsPlatform.cs @@ -217,13 +217,6 @@ namespace System.Management.Automation } - // This is mainly with respect to the auto-mounting of - // disconnected network drives on Windows - internal static bool HasDriveAutoMounting() - { - return IsWindows; - } - // Linux does not have a registry internal static bool HasRegistrySupport() { diff --git a/src/System.Management.Automation/engine/SessionStateDriveAPIs.cs b/src/System.Management.Automation/engine/SessionStateDriveAPIs.cs index d7e0f8e384..6de20eee21 100644 --- a/src/System.Management.Automation/engine/SessionStateDriveAPIs.cs +++ b/src/System.Management.Automation/engine/SessionStateDriveAPIs.cs @@ -1469,11 +1469,12 @@ namespace System.Management.Automation bool driveIsValid = true; // If the drive is auto-mounted, ensure that it still exists, or remove the drive. - // note: not all platforms support drive auto-mounting - if (Platform.HasDriveAutoMounting() && (drive.IsAutoMounted || IsAStaleVhdMountedDrive(drive))) +#if !LINUX + if (drive.IsAutoMounted || IsAStaleVhdMountedDrive(drive)) { driveIsValid = ValidateOrRemoveAutoMountedDrive(drive, lookupScope); } +#endif if(drive.Name.Length == 1) { if(!(driveNames.Contains(drive.Name))) diff --git a/test/csharp/test_CorePsPlatform.cs b/test/csharp/test_CorePsPlatform.cs index 8709dccab5..44784983f3 100644 --- a/test/csharp/test_CorePsPlatform.cs +++ b/test/csharp/test_CorePsPlatform.cs @@ -15,12 +15,6 @@ namespace PSTests Assert.True(Platform.IsCore); } - [Fact] - public static void TestHasDriveAutoMounting() - { - Assert.False(Platform.HasDriveAutoMounting()); - } - [Fact] public static void TestHasRegistrySupport() {