Skip to content

Instantly share code, notes, and snippets.

@ionred
Last active October 7, 2022 01:45
Show Gist options
  • Save ionred/cb99efb1040070809f4dfc877e5b59fd to your computer and use it in GitHub Desktop.
Save ionred/cb99efb1040070809f4dfc877e5b59fd to your computer and use it in GitHub Desktop.
BasicAppInstall.txt
# Description: Basic App Install
# Author: BC 2022-10-02
#
# Install boxstarter:
# . { iwr -useb http://boxstarter.org/bootstrapper.ps1 } | iex; get-boxstarter -Force
#
# You might need to set: Set-ExecutionPolicy RemoteSigned
#
# Install-BoxstarterPackage -PackageName <URL-TO-RAW-GIST> -Credential (Get-Credential)
#
# Learn more: http://boxstarter.org/Learn/WebLauncher
$Boxstarter.RebootOk = $true # Allow reboots?
$Boxstarter.NoPassword = $false # Is this a machine with no login password?
$Boxstarter.AutoLogin = $true # Save my password securely and auto-login after a reboot
$computername = "FC-WS-OFC1"
#Update-ExecutionPolicy -Policy Unrestricted
#Set-ExecutionPolicy -ExecutionPolicy Unrestricted
Disable-MicrosoftUpdate
if ((test-path c:\ProgramData\Boxstarter\BoxstarterShell.ps1) -eq $false) {
. { Invoke-WebRequest -useb http://boxstarter.org/bootstrapper.ps1 } | Invoke-Expression
Get-Boxstarter -Force
refreshenv
choco feature enable -n allowGlobalConfirmation
}
$chocoTemp = "c:\temp\chocolatey"
$tools = @(
"microsoft-windows-terminal",
"notepadplusplus",
"sysinternals",
"7zip",
"curl",
"dotnetcore-runtime",
"python3",
"bind-toolsonly",
"Everything",
"procexp",
"Sudo",
"au",
"checksum",
"hwmonitor",
"rsync",
"rufus",
"es",
"sumatrapdf",
"yubikey-manager",
"powertoys"
)
$apps = @(
"visualstudiocode",
"googlechrome",
"putty",
"ublockorigin-chrome",
"brave",
"discord",
"filezilla",
"foxitreader",
"github-desktop",
"paint.net",
"pia",
"steam",
"veracrypt",
"vlc",
"plex",
"cpu-z",
"sabnzbd",
"gimp",
"epicgameslauncher",
"kdiff3",
"ubisoft-connect",
"autoruns")
$appxPkg = @(
"Microsoft.BingFinance",
"Microsoft.3DBuilder",
"Microsoft.BingNews",
"Microsoft.BingSports",
"Microsoft.BingWeather",
"Microsoft.CommsPhone",
"Microsoft.Getstarted",
"Microsoft.WindowsMaps",
"*MarchofEmpires*",
"*Minecraft*",
"Microsoft.OneConnect",
"Microsoft.WindowsPhone",
"Microsoft.Office.Sway",
"Microsoft.XboxApp",
"Microsoft.XboxIdentityProvider",
"Microsoft.XboxGameOverlay",
"Microsoft.XboxGamingOverlay",
"Microsoft.NetworkSpeedTest",
"Microsoft.FreshPaint",
"Microsoft.Print3D",
"Microsoft.People*",
"Microsoft.Microsoft3DViewer",
"Microsoft.MixedReality.Portal*",
"*Skype*",
"*Autodesk*",
"*BubbleWitch*",
"king.com*",
"G5*",
"*Dell*",
"*Facebook*",
"*Keeper*",
"*Netflix*",
"*Twitter*",
"*Plex*",
"*.Duolingo-LearnLanguagesforFree",
"*.AdobePhotoshopExpress",
"MicrosoftTeams"
)
$codeExtensions = @(
"ms-vscode.PowerShell",
"streetsidesoftware.code-spell-checker",
"ms-vscode-remote.remote-wsl",
"vscode-icons-team.vscode-icons",
"visualstudioexptteam.vscodeintellicode",
"ms-azuretools.vscode-docker",
"pkief.material-icon-theme",
"christian-kohler.path-intellisense",
"zhuangtongfa.material-theme",
"ms-python.python",
"ms-python.vscode-pylance",
"vsls-contrib.gistfs",
"VisualStudioExptTeam.intellicode-api-usage-examples"
)
$psModules = @(
"AppVeyorBYOC"
)
$exclusionPaths = @(
"C:\ProgramData\chocolatey",
"C:\tools\NirLauncher",
"C:\temp\chocolatey"
)
$wingetPackages = @(
"9PMMSR1CGPWG", #HEIF Image Extensions
"9n4wgh0z6vhq" # HEVC Video Extensions from Device Manufacturer
)
if (Get-UAC) {
Write-BoxstarterMessage "Disabling UAC"
Disable-UAC
}
#Per Gary, this can speed up lookups
if (choco config get cacheLocation --limit-output -ne $chocoTemp) {
choco config set cacheLocation c:\temp\chocolatey
}
#Remove Windows Store Packages
$appxPkg | ForEach-Object {
Get-AppxPackage $_ | ForEach-Object {
Write-BoxstarterMessage "Removing $_"
Remove-AppxPackage $_
}
}
#Show Hidden Files
if ((Test-Path c:\temp\hiddenEnabled.a) -eq $false) {
Write-BoxstarterMessage "Showing Hidden Files"
Set-WindowsExplorerOptions -EnableShowHiddenFilesFoldersDrives -EnableShowProtectedOSFiles -EnableShowFileExtensions
New-Item "c:\temp\hiddenEnabled.a" -ItemType File -Force
}
#Create Defender Exclusions
$currentExclusions = Get-MpPreference | Select-Object -ExpandProperty ExclusionPath
if (@(Compare-Object -ReferenceObject $currentExclusions -DifferenceObject $exclusionPaths).Length -ne 0) {
Write-BoxstarterMessage "Whitelisting Folders"
$exclusionPaths | ForEach-Object { Add-MpPreference -ExclusionPath $_ }
}
#Remove Chat Button From from Windows 11 taskbar
Set-ItemProperty HKCU:Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced -Name TaskbarMn -Value 0
#Remove Widgets Button from Windows 11 taskbar
set-ItemProperty HKCU:Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced -Name TaskbarDa -Value 0
#Remove TaskView Button From from Windows 11 taskbar
Set-ItemProperty HKCU:Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced -Name ShowTaskViewButton -Value 0
#Left Alight buttons on Windows 11 taskbar
Set-ItemProperty HKCU:Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced -Name TaskbarAl -Value 0
#Get Chocolatey Installed Packages
##Removed this clean line because of issues with boxstarter
##$currentlyInstalledPackages = (choco list --lo --id-only --limit-output)
$currentlyInstalledPackages = @($(Get-ChildItem "${env:ChocolateyInstall}/lib/*/*.nuspec") | Foreach-Object {
[xml]$nuspec = Get-Content $_.FullName
$nuspec.package.metadata.id
})
#Install Tools First
$missingPackages = $null
Write-BoxstarterMessage "tools:"
Write-BoxstarterMessage "$tools"
Write-BoxstarterMessage "curpkgs:"
Write-BoxstarterMessage "$currentlyInstalledPackages"
Write-BoxstarterMessage "missingTools"
$missingPackages = $tools | select-object -Unique | Compare-Object $currentlyInstalledPackages | Where-Object { $_.SideIndicator -eq "=>" } | Select-Object -ExpandProperty inputobject
if ($missingPackages.Count -gt 0) {
Write-BoxstarterMessage "Missing Tools Found"
Write-BoxstarterMessage "$missingPackages"
$missingPackages | foreach-object {
choco install $_
}
}
#Install Apps
$missingPackages = $null
$missingPackages = $apps | select-object -Unique | Compare-Object $currentlyInstalledPackages | Where-Object { $_.SideIndicator -eq "=>" } | Select-Object -ExpandProperty inputobject
if ($missingPackages.Count -gt 0) {
Write-BoxstarterMessage "Missing Apps Found"
Write-BoxstarterMessage "$missingPackages"
$missingPackages | foreach-object {
choco install $_
}
}
remove-ItemProperty HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Run\ -Name Discord
remove-ItemProperty HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Run\ -Name Steam
#Install Stuff that is being picky and can't go in a piped value because of chocolatey's weird stuff with quotes
if ($null -eq (choco list git.install --lo --limit-output )) {
choco install git.install -params "'/GitAndUnixToolsOnPath /WindowsTerminal /NoShellIntegration /editor:Notepad++'"
}
if ($null -eq (choco list nirlauncher --lo --limit-output )) {
choco install nirlauncher --params "'/Sysinternals'"
}
function Download-AppxPackage {
[CmdletBinding()]
param (
[Parameter(Mandatory=$true)] [string]$ProductID
)
process {
$path = "c:\temp"
$WebResponse = Invoke-WebRequest -Method 'POST' -Uri 'https://store.rg-adguard.net/api/GetFiles' -Body "type=ProductId&url=$productID&ring=Retail&lang=en-US" -ContentType 'application/x-www-form-urlencoded'
$LinksMatch = $WebResponse.Links | where { $_ -like '*_x64*.appx*' }
$DownloadLinks = $LinksMatch.href -replace '&amp;', '&'
#$DownloadLinks
Invoke-WebRequest -Uri "$DownloadLinks" -OutFile "$Path\$productID.appx"
Add-AppxPackage "$Path\$productID.appx"
Remove-Item "$Path\$productID.appx" -Force
}
}
#Install Winget Packages
if ($wingetPackages -ne $null) {
$wingetPackages | foreach-object {
#all winget apps are from windows store and currently the winget store option
#is broken and returning server error (if you get one at all)
#utilizing download-appxpackage function to temporarily replace
#winget install $_ --accept-package-agreements --accept-source-agreements
Download-AppxPackage $_
}
}
#--- Visual Studio Code Extensions
refreshenv
$currentlyInstalledCodeExtensions = (code --list-extensions)
$missingExtensions = $null
$missingExtensions = $codeExtensions | select-object -Unique | Compare-Object $currentlyInstalledCodeExtensions | Where-Object { $_.SideIndicator -eq "=>" } | Select-Object -ExpandProperty inputobject
if ($missingExtensions.Count -gt 0) {
Write-BoxstarterMessage "Missing VS Code Extensions Found"
Write-BoxstarterMessage "$missingExtensions"
$missingExtensions | foreach-object {
code --install-extension $_
}
}
#Install Powershell Packages
Install-PackageProvider -Name NuGet -Force
$currentPSModule = Get-Module -ListAvailable | Select-Object -ExpandProperty name
$missingModules = $null
$missingModules = $psModules | select-object -Unique | Compare-Object $currentPSModule | Where-Object { $_.SideIndicator -eq "=>" } | Select-Object -ExpandProperty inputobject
if ($missingModules.Count -gt 0) {
Write-BoxstarterMessage "Missing PowerShell Packages"
Write-BoxstarterMessage "$missingModules"
$missingModules | foreach-object {
Install-Module $_ -Force
}
}
Write-BoxstarterMessage "Installing SSH Client"
Add-WindowsCapability -Online -Name 'OpenSSH.Client~~~~0.0.1.0'
#Configure GIT
$gitHubConfig = @{
"user.name" = "ionred";
"user.email" = "[email protected]"
"safe.directory" = "D:/git/chocolatey-packages";
"credential.helper" = "store";
"core.editor" = "'C:/Program Files (x86)/Notepad++/notepad++.exe' -multiInst -notabbar -nosession -noPlugin"
}
$gitHubConfig.GetEnumerator() | ForEach-Object { if ($gitCurrentConfig -notcontains "$($_.name)=$($_.value)") { git config --global $_.name $_.value } }
Write-BoxstarterMessage "Installing Windows Sandbox"
Enable-WindowsOptionalFeature -FeatureName "Containers-DisposableClientVM" -All -Online
Write-BoxstarterMessage "Installing Windows Subsystem for Linux"
wsl.exe --install
Write-BoxstarterMessage "Enabling UAC"
Enable-UAC
Write-BoxstarterMessage "Enabling Microsoft Update"
Enable-MicrosoftUpdate
Write-BoxstarterMessage "Enabling Windows Update"
Install-WindowsUpdate -AcceptEula -GetUpdatesFromMS
if ($env:computername -ne $computername) {
Write-BoxstarterMessage "Renaming Computer to $computername"
Rename-Computer -NewName $computername
}
Write-BoxstarterMessage "Opening Driver Pages"
Start-Process "https://www.amd.com/en/support/graphics/radeon-500-series/radeon-rx-500-series/radeon-rx-580"
Start-Process "https://www.asrock.com/MB/AMD/B450M%20Pro4-F/index.asp#Download"
$Boxstarter.RebootOk = $false # Allow reboots?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment