Last active
June 10, 2024 04:14
-
-
Save ethanbergstrom/9a4a0d29ea0452ef46bba580a7567d98 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#region Local Configuration Manager | |
[DSCLocalConfigurationManager()] | |
configuration LCMConfig | |
{ | |
Node localhost | |
{ | |
Settings | |
{ | |
ConfigurationMode = 'ApplyAndAutoCorrect' | |
# Check for updates once a day | |
ConfigurationModeFrequencyMins = 1440 | |
} | |
} | |
} | |
LCMConfig | |
Set-DscLocalConfigurationManager .\LCMConfig\ -Verbose | |
Remove-Item .\LCMConfig\ -Force -Recurse | |
#endregion | |
#region Package Management | |
$cred = Get-Credential | |
$data = @{ | |
AllNodes = | |
@( | |
@{ | |
NodeName = 'localhost' | |
Packages = @( | |
'7zip.7zip', | |
'Balena.Etcher', | |
'CPUID.HWMonitor', | |
'dbeaver.dbeaver', | |
'Docker.DockerDesktop', | |
'Git.Git', | |
'Hashicorp.Vagrant', | |
'Microsoft.PowerShell', | |
'Microsoft.WindowsTerminal', | |
'Notepad++.Notepad++', | |
'Telerik.Fiddler.Classic', | |
'WinSCP.WinSCP' | |
) | |
# This is not secure! Encrypt DSC MOFs with certificates for secure usage. | |
PSDscAllowDomainUser = $true | |
PsDscAllowPlainTextPassword = $true | |
Credential = $cred | |
} | |
) | |
} | |
Configuration DevTools { | |
Import-DscResource -ModuleName PackageManagement -ModuleVersion 1.4.7 | |
Node $AllNodes.NodeName { | |
PackageManagement WinGet { | |
Name = 'WinGet' | |
Source = 'PSGallery' | |
} | |
foreach ($package in $Node.Packages) { | |
PackageManagement $package { | |
Name = $package | |
ProviderName = 'WinGet' | |
RequiredVersion = 'latest' | |
DependsOn = @('[PackageManagement]WinGet') | |
# Required for the LCM to interact with your WinGet execution alias / source data | |
PsDscRunAsCredential = $Node.Credential | |
} | |
} | |
} | |
} | |
DevTools -ConfigurationData $data | |
Start-DscConfiguration .\DevTools -Force -Wait -Verbose | |
Remove-Item .\DevTools\ -Recurse -Force | |
#endregion |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment