This topic contains 2 replies, has 2 voices, and was last updated by
August 2, 2017 at 2:20 pm #76448ParticipantTopics: 12Replies: 33Points: 59Rank: Member
When using composite resources, it becomes impossible to use PSDscResources, as it refuses to import. Worse, it's presence alone prevent the configuration from being run, thus making it impossible to create any mof
The error given is:
ImportClassResourcesFromModule : Exception calling "ImportClassResourcesFromModule" with "3" argument(s): "Resource name 'WindowsPackageCab' is already being used by another Resource or
At C:\Windows\system32\WindowsPowerShell\v1.0\Modules\PSDesiredStateConfiguration\PSDesiredStateConfiguration.psm1:2109 char:35
+ ... rcesFound = ImportClassResourcesFromModule -Module $mod -Resources $r ...
+ CategoryInfo : NotSpecified: (:) [ImportClassResourcesFromModule], MethodInvocationException
+ FullyQualifiedErrorId : PSInvalidOperationException,ImportClassResourcesFromModule
I've opened an issue on Github, but maybe someone here has a clue about this problem?
The problem arise as soon as you import a composite resource inside a configuration and have PsDscResources 18.104.22.168 installed.
August 2, 2017 at 5:26 pm #76495ParticipantTopics: 0Replies: 2Points: 22Rank: Member
I have exactly the same problem and so far I had no luck with resolving it.
September 8, 2017 at 2:58 pm #79129ParticipantTopics: 12Replies: 33Points: 59Rank: Member
Problem found: The resolution thread is here
Basically, there seem to be a problem if we load a composite resource as a second argument. This doesn't work:
Import-DscResource -Module xActiveDirectory, YourCompositeRessource Import-DscResource -Module PSDscResources -ModuleVersion 22.214.171.124
Import-DscResource -Module xActiveDirectory, Import-DscResource - Module YourCompositeRessource, Import-DscResource -Module PSDscResources -ModuleVersion 126.96.36.199
No idea why, as loading more than one module on a line never gave us any problem until we tried to use a newer version of PsDscResources. I guess it loads it as "Import-Module" instead of "Import-DscResource" This is pure speculation though, but the end result is that it doesn't work. Separating it on it's own line works perfectly.
The topic ‘Cannot load PSDscResources when using composite resources’ is closed to new replies.