SynEdgy / Sampler.DscPipeline

DSC Pipeline Helpers and tasks for use with Datum
MIT License
9 stars 9 forks source link

Reset PSModulePath after MOF compilation of each node #21

Closed stehlih closed 8 months ago

stehlih commented 1 year ago

Pull Request (PR) description

Reset PSModulePath after MOF compilation of each node to avoid duplicate CIM class definition errors on the following nodes

Task list


This change is Reviewable

raandree commented 1 year ago

@stehlih, do we still need this given the new Sampler task Set_PSModulePath? In #24 I have proposed to remove the PSModulePath manipulation completely as it can be configured and controlled by means of the task Set_PSModulePath.

stehlih commented 1 year ago

If certificates are used to encrypt passwords the PSModulePath is changed by some DSC resources during MOF compile. This fix allows a clean start of MOF compile for each node by restoring the PSModulePath to the original value at task start. The Set_PSModulePath task doesn't solve this problem.

gaelcolas commented 1 year ago

@stehlih could you specify which ones --> "some DSC resources" ? Are they DSC Community resources? Thanks

raandree commented 1 year ago

I still have this on my list. @stehlih and I found also, that eror handling in case credential decryption does not work should be improved. I hope to be able to have a look at this over the weekend.

@stehlih, but do we have this issue in general or only with specific resources?

stehlih commented 1 year ago

The issue is caused by resources with configured credentials (e.g. ComputerSettings from CommonTasks if the Credential attribute is set). After first occurence of this error the MOF compilation of all following nodes fails with "duplicate CIM classes or duplicate modules found" error. With this fix the following nodes hava a chance to compile without errors.

VEUA01A01 : VEUA01A01 : MOF__ NA VEUA01A01 : Client_Local_TO_EUA-SW ::> DscTagging ..............................................OK VEUA01A01 : Client_Local_TO_EUA-SW ::> OpticalDiskDrives .......................................OK VEUA01A01 : Client_Local_TO_EUA-SW ::> PowerPlans ..............................................OK VEUA01A01 : Client_Local_TO_EUA-SW ::> CertificateImports ......................................OK VEUA01A01 : Client_Local_TO_EUA-SW ::> NetworkIpConfiguration ..................................OK VEUA01A01 : Client_Local_TO_EUA-SW ::> ComputerSettings ........................................OK VEUA01A01 : Client_Local_TO_EUA-SW ::> WindowsOptionalFeatures .................................OK VEUA01A01 : Client_Local_TO_EUA-SW ::> FilesAndFolders .........................................OK ImportCimAndScriptKeywordsFromModule : Bei der Verarbeitung der Schemadatei "C:\Program Files\WindowsPowerShell\Modules\ PackageManagement\1.4.8.1\DSCResources\MSFT_PackageManagement\MSFT_PackageManagement.Schema.mof" wurde eine zweite CIM-Klassendefinition für "MSFT_PackageManagement" gefunden. Diese Klasse wurde bereits in den D:\SBX\WSP-Core\Impl\DscR efConfig\Output\output\RequiredModules\PackageManagement\1.4.8.1\DSCResources\MSFT_PackageManagement\MSFT_PackageManagem ent.Schema.mof-Dateien definiert. Entfernen Sie die redundante Definition, und wiederholen Sie den Vorgang. In C:\windows\system32\windowspowershell\v1.0\Modules\PSDesiredStateConfiguration\PSDesiredStateConfiguration.psm1:2120

raandree commented 8 months ago

This PR is no longer required, we have done the necessary changes in all DSC composite resources of CommonTasks.

@stehlih, please reach out to me if there is further trouble.