Author Posts

December 3, 2015 at 9:24 am

I have created a DSC module that has few helper functions in it. I would like to use a cmdlet in one of the helper functions from a PS module in one of the helper functions that I have included in DSC module.

In my tests the helper function was unable to execute the cmdlet as it was not recognized. Obviously the PS module should be imported before running cmdlet in the DSC's module helper function.

So is it possible to create some sort of dependence for DSC module that would import PS module that contains this cmdlet?

December 3, 2015 at 9:27 am

So:

DSC module has Helper Functions.

Helper Functions need to use a command that lives in a normal Module.

Is the Module correctly stored in one of the paths in your PSModulePath environment variable? If not, the Module will need to be loaded ahead of time. Would it be possible to simply put the Module into one of the correct paths?

December 4, 2015 at 2:37 am

The module is in the correct location.
How would I load the normal module ahead when DSC module runs and runs the normal command that's in the normal module?

Do I run the import-module cmdlet in DSC's module helper function?

December 4, 2015 at 4:07 am

Sorted by running import-module when calling the helper function.