What is best practice around PackageManagement module?

Welcome Forums DSC (Desired State Configuration) What is best practice around PackageManagement module?

This topic contains 5 replies, has 3 voices, and was last updated by

 
Participant
6 months ago.

  • Author
    Posts
  • #109102
    GS

    Participant
    Points: 12
    Rank: Member

    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?

  • #109103

    Keymaster
    Points: 1,811
    Helping HandTeam Member
    Rank: Community Hero

    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.

  • #109115
    GS

    Participant
    Points: 12
    Rank: Member

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

  • #109127

    Participant
    Points: 1,351
    Helping Hand
    Rank: Community Hero

    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″}
    
  • #109147
    GS

    Participant
    Points: 12
    Rank: Member

    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?

  • #109151

    Participant
    Points: 1,351
    Helping Hand
    Rank: Community Hero

    Latest version will be picked by default.

The topic ‘What is best practice around PackageManagement module?’ is closed to new replies.

denizli escort samsun escort muğla escort ataşehir escort kuşadası escort