diff --git a/src/System.Management.Automation/DscSupport/CimDSCParser.cs b/src/System.Management.Automation/DscSupport/CimDSCParser.cs index 15deef3d1be..2f590a8031d 100644 --- a/src/System.Management.Automation/DscSupport/CimDSCParser.cs +++ b/src/System.Management.Automation/DscSupport/CimDSCParser.cs @@ -663,7 +663,17 @@ public static void Initialize(Collection errors, List moduleP } else { - var systemResourceRoot = Path.Combine(Platform.GetFolderPath(Environment.SpecialFolder.System), "Configuration"); + // DSC SxS scenario + var psAssembly = Assembly.GetEntryAssembly(); + var configSystemPath = Path.GetDirectoryName(psAssembly.Location); + var systemResourceRoot = Path.Combine(configSystemPath, "Configuration"); + var inboxModulePath = "Modules\\PSDesiredStateConfiguration"; + if( !Directory.Exists(systemResourceRoot)) + { + configSystemPath = Platform.GetFolderPath(Environment.SpecialFolder.System); + systemResourceRoot = Path.Combine(configSystemPath, "Configuration"); + inboxModulePath = InboxDscResourceModulePath; + } var programFilesDirectory = Platform.GetFolderPath(Environment.SpecialFolder.ProgramFiles); Debug.Assert(programFilesDirectory != null, "Program Files environment variable does not exist!"); var customResourceRoot = Path.Combine(programFilesDirectory, "WindowsPowerShell\\Configuration"); @@ -704,7 +714,7 @@ public static void Initialize(Collection errors, List moduleP List modulePaths = new List(); if (modulePathList == null || modulePathList.Count == 0) { - modulePaths.Add(Path.Combine(Platform.GetFolderPath(Environment.SpecialFolder.System), InboxDscResourceModulePath)); + modulePaths.Add(Path.Combine(configSystemPath, inboxModulePath)); isInboxResource = true; } else