Inedo Community Forums Forums
    • Recent
    • Tags
    • Popular
    • Login

    Welcome to the Inedo Forums! Check out the Forums Guide for help getting started.

    If you are experiencing any issues with the forum software, please visit the Contact Form on our website and let us know!

    Ensure-DSC and Module version

    Scheduled Pinned Locked Moved Support
    otter
    6 Posts 3 Posters 24 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • P Offline
      philippe.camelio_3885
      last edited by

      Hello

      As PS Module version management is a mess, I am looking to call Ensure-DSC with a specific version of a module as it is possible with the Invoke-DscResource unsuccessfully.
      Any exemple might helpfull

      Thanks in advance

      Best Regards

      PhilippeC.

      1 Reply Last reply Reply Quote 0
      • atrippA Offline
        atripp inedo-engineer
        last edited by

        Hmmm, I'm not sure if it's possible... I don't know if PowerShell even allows multiple versions of the same module/resource to be installed on the same server?

        P 1 Reply Last reply Reply Quote 0
        • P Offline
          philippe.camelio_3885 @atripp
          last edited by philippe.camelio_3885

          The Invoke-DscRessource allows this.
          Ensure-DSC should be improved, if possible. It's been a long time since Otter was updated 😊

          Invoke-DscResource -Method Test -Name WindowsFeature -Property @{Name='RSAT-AD-PowerShell'; IncludeAllSubFeature=$true; ensure='Present'} -ModuleName @{ModuleName=’PSDscResources’; ModuleVersion=2.2.0.0’} -Verbose
          

          As enhancement, it would be nice to have a function Ensure-Module in order to manage properly PS Module.

          I have done a small set of functions based on PackageManagement but it does not work properly for the Module installation as it does remove the old version.

          ##AH:UseTextMode
          ##AH:Description Définition d'un dépôt
          module PackageManagementSource<$Nom, $Ensure = present, $SourceLocation, $ProviderName = PowerShellGet, $InstallationPolicy = Untrusted>
          {
              Ensure-DscResource
              (
                  ConfigurationKey: Name,
                  Name: PackageManagementSource,
                  Module: PackageManagement,
                  Properties: %(Name:$Nom,ProviderName:$ProviderName,SourceLocation:$SourceLocation,InstallationPolicy:$InstallationPolicy,Ensure:$Ensure)
              )
          }
          
          ##AH:UseTextMode
          ##AH:Description Installation de modules PS à partir d'un dépôt
          module PackageManagement<$Module, $Version, $Source = internal-psm, $Ensure = Present>
          {
              log-information Module: $Module - $Version - $Ensure;
              Ensure-DscResource
              (
                  ConfigurationKey: Name,
                  Name: PackageManagement,
                  Module: PackageManagement,
                  Properties: %(Name:$Module,RequiredVersion:$Version,Source:$Source,Ensure:$Ensure)
              );
          }
          

          note:
          There are some prerequisites to have PackageManagement 1.4.7.

          1 Reply Last reply Reply Quote 0
          • rhessingerR Offline
            rhessinger inedo-engineer
            last edited by

            Hi @philippe-camelio_3885,

            For an Ensure-PSModule command, here is what I'm thinking.

            Ensure-PSModule {
               ModuleName: ...
               Version: ...
               MinVersion:...
               MaxVersion:...
               Force: false
               AllowClobber: false
               Repository: ... 
               Credential: ...(I expect this to be a ResourceCredential)
               Scope:...
               Properties: ... (any other additional properties to pass to Install-Module)
            }
            

            Where it just ensures that version (or within the min/max) is installed.

            Am I understanding your request correctly?

            Thanks,
            Rich

            Products Engineer, Inedo

            P 1 Reply Last reply Reply Quote 0
            • P Offline
              philippe.camelio_3885 @rhessinger
              last edited by

              Hi @rhessinger
              Sorry for the delay

              Yes this is exactly what it should be.

              1 Reply Last reply Reply Quote 0
              • rhessingerR Offline
                rhessinger inedo-engineer
                last edited by

                Hi Phillipe,

                I created an issue on GitHub, #8, to track adding this to the extension. I'll reply back once there is a CI version released of the extension.

                Thanks,
                Rich

                Products Engineer, Inedo

                1 Reply Last reply Reply Quote 0

                Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                With your input, this post could be even better 💗

                Register Login
                • 1 / 1
                • First post
                  Last post
                Inedo Website Home • Support Home • Code of Conduct • Forums Guide • Documentation