Author Posts

August 20, 2018 at 9:38 pm

Hello,

I'm confused about what I'm supposed to do with built in PackageManagement module which comes preinstalled with Windows 2016. I can not update it directly since it was not installed from Gallery and when I install newer version from Gallery I end up with 2 modules and 2 names for all DSC Resources. How do I uninstall built in module or what is best practice here?

August 20, 2018 at 9:41 pm

Yeah, unfortunately due to the way protected system files exist, they can't be updated that way (although you can try using -Force). The most you can do is try to delete them, although in many cases the system will attempt to "repair" itself and put them back. It's something I don't think they thought through really well.

This actually comes up with Pester a lot (see https://github.com/pester/Pester/issues/488 as well as https://github.com/pester/Pester/issues/585); it might be useful to look at what other folks have donee and see what works for you.

August 20, 2018 at 10:36 pm

How do I properly refer to latest version of PackageManagement module in such cases when using Import-Module or Import-DSCResource

August 21, 2018 at 4:00 am

You can target a version using -RequiredVersion parameter for Import-module cmdlet. There are more ways to control version for this cmdlet. I suggest you to take a look at the help documentation of Import-Module cdmlet.

for Import-DSCResource, below usage can be done.

Import-DscResource -ModuleName @{ModuleName='yourModule';ModuleVersion=”1.0″}

August 21, 2018 at 11:44 am

I need to load latest version of module. Notation inside Import-DSCresource requires exact module version. Script I'm working on will be used on computers for quite sometime and I want always the latest version of PackageManagement resources to be used. I assume there is no solution to this?

August 21, 2018 at 12:03 pm

Latest version will be picked by default.