Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adopt 'winget configure' / DSCv3 #23

Open
kergoth opened this issue Feb 13, 2024 · 2 comments
Open

Adopt 'winget configure' / DSCv3 #23

kergoth opened this issue Feb 13, 2024 · 2 comments

Comments

@kergoth
Copy link
Owner

kergoth commented Feb 13, 2024

No description provided.

@kergoth
Copy link
Owner Author

kergoth commented Feb 20, 2024

Example configuration:

# yaml-language-server: $schema=https://aka.ms/configuration-dsc-schema/0.2
# Either this, in PowerShell 7: Get-WinGetConfiguration -File sandbox.dsc.yaml | Invoke-WinGetConfiguration
# Or winget configure ./configuration.dsc.yaml
properties:

  assertions:
    - resource: Microsoft.Windows.Developer/OsVersion
      directives:
        description: Verify min OS version requirement
        allowPrerelease: true
      settings:
        MinVersion: '10.0.22000'
  resources:
  # Enable Developer Mode
    - resource: Microsoft.Windows.Developer/DeveloperMode
      directives:
        description: Enable Developer Mode
        allowPrerelease: true
      settings:
        Ensure: Present
  # Show file extensions
    - resource: Microsoft.Windows.Developer/HideFileExtensions
      directives:
        description: Show file extensionss
        allowPrerelease: true
      settings:
        Ensure: Absent
  # Show hidden files
    - resource: Microsoft.Windows.Developer/ShowHiddenFiles
      directives:
        description: Show hidden files
        allowPrerelease: true
      settings:
        Ensure: Present
  # Set taskbar alignment to middle
    - resource: Microsoft.Windows.Developer/TaskBarAlignment
      id: Middle
      directives:
        description: Set taskbar alignment to middle
        allowPrerelease: true
      settings:
        Alignment: Middle
  # Install Visual Studio 2022 Community
    - resource: Microsoft.WinGet.DSC/WinGetPackage
      id: vsPackage
      directives:
        description: Install Visual Studio 2022 Community
        allowPrerelease: true
      settings:
        id: Microsoft.VisualStudio.2022.Community
        source: winget
    # - resource: Microsoft.VisualStudio.DSC/VSComponents
    #   dependsOn:
    #     - vsPackage
    #   directives:
    #     description: Install required VS workloads for DevHome
    #     allowPrerelease: true
    #   settings:
    #     productId: Microsoft.VisualStudio.Product.Community
    #     channelId: VisualStudio.17.Release
    #     vsConfigFile: '${WinGetConfigRoot}\..\.vsconfig'
    #     includeRecommended: true
  # Install PowerShell 7
    - resource: Microsoft.WinGet.DSC/WinGetPackage
      id: PowerShell 7
      directives:
        description: Install PowerShell 7
        # allowPrerelease: true
      settings:
        id: Microsoft.PowerShell
        source: winget
  # Install Git
    - resource: Microsoft.WinGet.DSC/WinGetPackage
      id: git
      directives:
        description: Install GIT
        # allowPrerelease: true
      settings:
        id: git.git
        source: winget
  # Install Visual Studio Code
    - resource: Microsoft.WinGet.DSC/WinGetPackage
      id: Visual Studio Code
      directives:
        description: Install Visual Studio Code
        # allowPrerelease: true
      settings:
        id: Microsoft.VisualStudioCode
        source: winget
  # Enable and Start SSH Agent service
    - resource: PsDscResources/Service
      id: ssh-agent
      directives:
        description: Enable and Start SSH Agent service
      settings:
        Name: ssh-agent
        Ensure: Present
        StartupType: Automatic
        State: Running

  configurationVersion: 0.2.0

@kergoth
Copy link
Owner Author

kergoth commented Feb 12, 2025

Example configuration requiring admin rights:

# yaml-language-server: $schema=https://aka.ms/configuration-dsc-schema/0.2
# As admin: Get-WinGetConfiguration -File sandbox.dsc.yaml | Invoke-WinGetConfiguration
properties:
  assertions:
    - resource: Microsoft.Windows.Developer/OsVersion
      directives:
        description: Verify min OS version requirement
        allowPrerelease: true
      settings:
        MinVersion: '10.0.22000'
  resources:
    # Enable WSL
    - resource: PsDscResources/WindowsOptionalFeature
      id: Microsoft-Windows-Subsystem-Linux
      directives:
        description: Enable WSL
      settings:
        Name: Microsoft-Windows-Subsystem-Linux
        Ensure: Present
    # Enable Virtual Machine Platform for WSL 2
    - resource: PsDscResources/WindowsOptionalFeature
      id: VirtualMachinePlatform
      directives:
        description: Enable Virtual Machine Platform for WSL 2
      settings:
        Name: VirtualMachinePlatform
        Ensure: Present
    # Enable Windows Sandbox
    - resource: PsDscResources/WindowsOptionalFeature
      id: Containers-DisposableClientVM
      directives:
        description: Enable Windows Sandbox
      settings:
        Name: Containers-DisposableClientVM
        Ensure: Present
    # Configure Windows Defender
    - resource: WindowsDefender/WindowsDefender
      directives:
        description: Configure Windows Defender Settings
      settings:
        IsSingleInstance: "Yes"
        DisableBehaviorMonitoring: false
        DisableIntrusionPreventionSystem: false

  configurationVersion: 0.2.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant