Skip to content

Holds the winget machine configuration to be used on a brand new OS installation .

Notifications You must be signed in to change notification settings

robert-cpl/winget-dsc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

61 Commits
 
 
 
 
 
 
 
 

Repository files navigation

About

This is a PowerShell script that leverages the winget configuration command to apply a custom profile to your Windows Installation.
The script will stitch together a winget configuration file based on the profile you chose.

Usage

One line command:
iwr -useb https://dsc.copilau.me | iex
or
iwr -useb https://raw.githubusercontent.com/robert-cpl/winget-dsc/main/apply-configuration.ps1 | iex

Resource examples

An assortment of examples for the resources that are available to execute in the configuration.
The full list of resources can be found here.

PowrShell Script

- resource: PSDscResources/Script
  id: psscript
  directives:
    description: Create file with PowerShell
  settings:
    GetScript: |
        $fileContent = $null
        $filePath = "C:\Users\user\Desktop\test.txt"  
        if (Test-Path -Path $filePath) {
            $fileContent = Get-Content -Path $filePath -Raw
        }  
        return @{
            Result = $fileContent
        }
    TestScript: |
        $fileContent = $null
        $filePath = "C:\Users\user\Desktop\test.txt"
        if (Test-Path -Path $filePath) {
            $fileContent = Get-Content -Path $filePath -Raw
            return ($fileContent -eq $FileContent)
        } else {
            return $false
        }
    SetScript: |
        $fileContent = "Hello World!"
        $filePath = "C:\Users\user\Desktop\test.txt"
        $streamWriter = New-Object -TypeName 'System.IO.StreamWriter' -ArgumentList @(
            $filePath
        )
        $streamWriter.WriteLine($fileContent)
        $streamWriter.Close()

WinGet package

- resource: Microsoft.WinGet.DSC/WinGetPackage
  directives:
    description: Install Visual Studio Code
    allowPrerelease: true
  settings:
    id: Microsoft.VisualStudioCode
    source: winget
    Ensure: Present

Registry Key

- resource: PSDscResources/Registry
  id: UpdateStartLayout
  directives:
    description: Updates the start menu layout to less recommendations and more pins
    allowPrerelease: false
  settings:
    Key: HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced
    ValueName: Start_Layout
    ValueType: DWord
    ValueData: 1
    Force: true
    Ensure: Present

About

Holds the winget machine configuration to be used on a brand new OS installation .

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published