Skip to content

Instantly share code, notes, and snippets.

@leandromonaco
Forked from codebytes/DevMachineSetup.ps1
Last active May 24, 2023 04:51
Show Gist options
  • Save leandromonaco/f827810b4c953a85218049c51e7e336f to your computer and use it in GitHub Desktop.
Save leandromonaco/f827810b4c953a85218049c51e7e336f to your computer and use it in GitHub Desktop.
DevMachineSetup
#This script is based on https://chris-ayers.com/2021/08/01/scripting-winget/
#Test ISO: https://www.microsoft.com/en-us/evalcenter/evaluate-windows-11-enterprise
#https://www.virtualbox.org/
#Install WinGet
#Based on this gist: https://gist.github.com/crutkas/6c2096eae387e544bd05cde246f23901
$hasPackageManager = Get-AppPackage -name 'Microsoft.DesktopAppInstaller'
if (!$hasPackageManager -or [version]$hasPackageManager.Version -lt [version]"1.10.0.0") {
"Installing winget Dependencies"
Add-AppxPackage -Path 'https://aka.ms/Microsoft.VCLibs.x64.14.00.Desktop.appx'
$releases_url = 'https://api.github.com/repos/microsoft/winget-cli/releases/latest'
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
$releases = Invoke-RestMethod -uri $releases_url
$latestRelease = $releases.assets | Where { $_.browser_download_url.EndsWith('msixbundle') } | Select -First 1
"Installing winget from $($latestRelease.browser_download_url)"
Add-AppxPackage -Path $latestRelease.browser_download_url
}
else {
"winget already installed"
}
#Configure WinGet
Write-Output "Configuring winget"
#winget config path from: https://github.com/microsoft/winget-cli/blob/master/doc/Settings.md#file-location
$settingsPath = "$env:LOCALAPPDATA\Packages\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe\LocalState\settings.json";
$settingsJson =
@"
{
// For documentation on these settings, see: https://aka.ms/winget-settings
"experimentalFeatures": {
"experimentalMSStore": true,
}
}
"@;
$settingsJson | Out-File $settingsPath -Encoding utf8
#Install New apps
Write-Output "Installing Apps"
$apps = @(
@{name = "Git.Git" },
@{name = "Microsoft.GitCredentialManagerCore" },
@{name = "Atlassian.Sourcetree" },
@{name = "TortoiseGit.TortoiseGit" },
@{name = "GitHub.CLI" },
@{name = "GitHub.GitHubDesktop" },
@{name = "Microsoft.DotNet.Framework.DeveloperPack_4" },
@{name = "Microsoft.DotNet.SDK.6" },
@{name = "Microsoft.DotNet.SDK.7" },
@{name = "Microsoft.PowerShell" },
@{name = "Microsoft.VisualStudio.2022.Professional" },
@{name = "Microsoft.VisualStudioCode" },
@{name = "Microsoft.NuGet" },
@{name = "Microsoft.SQLServerManagementStudio" },
@{name = "Microsoft.WindowsTerminal" },
@{name = "JanDeDobbeleer.OhMyPosh" },
@{name = "Python.Python.3.10" },
@{name = "CoreyButler.NVMforWindows" },
@{name = "JetBrains.PyCharm.Community" },
@{name = "Amazon.AWSCLI" },
@{name = "Amazon.SAM-CLI" },
@{name = "Amazon.NoSQLWorkbench" },
@{name = "Amazon.AWSVPNClient" },
@{name = "Postman.Postman" },
@{name = "RedisInsight" },
@{name = "BraveSoftware.BraveBrowser" },
@{name = "Mozilla.Firefox.DeveloperEdition" },
@{name = "Google.Chrome.Dev" },
@{name = "Dapr.CLI" },
@{name = "7zip.7zip" },
@{name = "Microsoft.PowerToys" },
@{name = "VideoLAN.VLC" },
@{name = "OBSProject.OBSStudio" },
@{name = "ShareX.ShareX" },
@{name = "Logseq.Logseq" },
@{name = "Twilio.Authy" },
@{name = "JAMSoftware.TreeSize.Free" },
@{name = "GIMP.GIMP" },
@{name = "DevToys" },
@{name = "WinMerge.WinMerge" },
@{name = "Microsoft.RemoteDesktopClient" },
@{name = "WiresharkFoundation.Wireshark" },
@{name = "Npcap" },
@{name = "Telerik.Fiddler.Classic" },
@{name = "Docker.DockerDesktop" },
@{name = "Canonical.Ubuntu.2204" },
@{name = "Oracle.VirtualBox" }
);
Foreach ($app in $apps) {
$listApp = winget list --exact -q $app.name --accept-source-agreements
if (![String]::Join("", $listApp).Contains($app.name)) {
Write-host "Installing:" $app.name
if ($app.source -ne $null) {
winget install --exact --silent $app.name --source $app.source --accept-package-agreements
}
else {
winget install --exact --silent $app.name --accept-package-agreements
}
}
else {
Write-host "Skipping Install of " $app.name
}
}
#Windows Feature
DISM /online /enable-feature /featurename:IIS-WebServerRole
DISM /online /enable-feature /featurename:IIS-WebServerManagementTools
DISM /online /enable-feature /featurename:IIS-ManagementConsole
DISM /online /enable-feature /featurename:IIS-NetFxExtensibility45
DISM /online /enable-feature /featurename:IIS-ISAPIExtensions
DISM /online /enable-feature /featurename:IIS-ISAPIFilter
DISM /online /enable-feature /featurename:IIS-ASPNET45
DISM /online /enable-feature /featurename:IIS-CGI
DISM /online /enable-feature /featurename:IIS-DefaultDocument
DISM /online /enable-feature /featurename:IIS-DirectoryBrowsing
DISM /online /enable-feature /featurename:IIS-HttpErrors
DISM /online /enable-feature /featurename:IIS-StaticContent
DISM /online /enable-feature /featurename:IIS-HttpLogging
DISM /online /enable-feature /featurename:IIS-HttpCompressionStatic
DISM /online /enable-feature /featurename:IIS-Security
DISM /online /enable-feature /featurename:IIS-IPSecurity
DISM /online /enable-feature /featurename:IIS-BasicAuthentication
DISM /online /enable-feature /featurename:IIS-WindowsAuthentication
DISM /online /enable-feature /featurename:IIS-DigestAuthentication
DISM /online /enable-feature /featurename:IIS-URLAuthorization
DISM /online /enable-feature /featurename:IIS-ClientCertificateMappingAuthentication
DISM /online /enable-feature /featurename:IIS-IISCertificateMappingAuthentication
DISM /online /enable-feature /featurename:IIS-CertProvider
#Setup WSL
wsl --install
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment