PSDesiredStateConfiguration
PSDesiredStateConfiguration copied to clipboard
Import-DscResource breaks with multiple copies of the same module on the system
Steps to reproduce
# Install the same module to two different paths that are in $env:PSModulePath e.g.
> Get-Module -ListAvailable -FullyQualifiedName xActiveDirectory
Directory: D:\Temp\a
ModuleType Version Name ExportedCommands
---------- ------- ---- ----------------
Manifest 2.17.0.0 xActiveDirectory
Directory: D:\Temp\b
ModuleType Version Name ExportedCommands
---------- ------- ---- ----------------
Manifest 2.17.0.0 xActiveDirectory
# and try to use this module in a DSC config
Configuration DSCImportTest { Import-DscResource -ModuleName xActiveDirectory }
Expected behavior
All DSC resources are imported from xActiveDirectory. Because -ModuleVersion
wasn't specified I'd expect the first encountered instance of the module to be imported regardless of the version.
Actual behavior
At line:1 char:31
+ ... ion DSCImportTest { Import-DscResource -ModuleName xActiveDirectory }
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Multiple versions of the module 'xActiveDirectory' were found. You can run 'Get-Module -ListAvailable -FullyQualifiedName xActiveDirectory' to see available versions on the system, and then use the fully qualified name '@{ModuleName="xActiveDirectory"; RequiredVersion="Version"}'.
+ CategoryInfo : ParserError: (:) [], ParentContainsErrorRecordException
+ FullyQualifiedErrorId : MultipleModuleEntriesFoundDuringParse
Environment data
> $PSVersionTable
Name Value
---- -----
PSVersion 6.0.1
PSEdition Core
GitCommitId v6.0.1
OS Microsoft Windows 10.0.17101
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
@StevenBucher98 / @anmenaga can this be moved/closed since the cmdlet isn't in this repository?