PSResourceGet icon indicating copy to clipboard operation
PSResourceGet copied to clipboard

PSResourceGet DSC resources

Open ThomasNieto opened this issue 1 year ago • 3 comments

Summary of the new feature / enhancement

As a user I want PSResourceGet to have DSC resources so I can declaratively manage PS resources.

Proposed technical implementation details (optional)

No response

ThomasNieto avatar Sep 10 '24 23:09 ThomasNieto

This is essentially a reask of #211 (when this repo was for PowerShellGet and had resources delivered) but to remove needing PowerShellGet/PackageManagement going forward

kilasuit avatar Sep 10 '24 23:09 kilasuit

Also worth noting that we have had this asked for as part of https://github.com/dsccommunity/ComputerManagementDsc with a PR currently open to add this using the older PowerShellGet/PackageManagement modules as a class resource There's also been talk about this being something that winget provides an access layer to in the winget-cli repo as part of the configurations that winget can apply

I agree though that PSResourceGet should author and own the resources and these can then be utilised in configurations & not require duplicated functionality in the ComputerManagementDSC repo.

kilasuit avatar Sep 11 '24 00:09 kilasuit

Would very much like to see this coming for several reasons. While the DSC community has tons of script-based DSC resources, movement around Microsoft modules aim towards class-based. More functionality is also build in the DSC v3 area that are not expanding to script-based ones for example the Export capability.

Take now for example when you want to bootstrap a local Windows machine. There's one simple step missing just before you start installing tools and packages through WinGet in a declarative way. To illustrate the missing step, take the code snippet below:

$schema: https://raw.githubusercontent.com/PowerShell/DSC/main/schemas/2024/04/config/document.json
metadata:
    Microsoft.DSC:
        securityContext: Elevated
resources:
  - name: Use class PowerShell resources
    type: Microsoft.DSC/PowerShell
    properties:
      resources:
        - name: Install WinGet PowerShell module  
          type: Microsoft.PSResourceGet.DSC/PSResourceGet # This is the missing step for triggering WinGet installation
          properties:
            Name: Microsoft.WinGet.DSC
            Repository: PSGallery
            Ensure: Present
            ReInstall: true
            RequiredVersion: 1.9.2411
        - name: PowerShell 7 Preview
          type: Microsoft.WinGet.DSC/WinGetPackage
          properties:
            Id: Microsoft.PowerShell.Preview
            Ensure: Present

PSResourceGet also removes the dependency on NuGet and is shipped with version 7.2+ if I'm not mistaken. This removes one more burden.

Gijsreyn avatar Oct 11 '24 12:10 Gijsreyn