Skip to content

Instantly share code, notes, and snippets.

@bertvv
Last active March 27, 2023 10:08
Show Gist options
  • Save bertvv/91ea188479d58931c6b354c838bb03a7 to your computer and use it in GitHub Desktop.
Save bertvv/91ea188479d58931c6b354c838bb03a7 to your computer and use it in GitHub Desktop.
Bootstrap script for basic Windows Server configuration
7zip
adobereader
atom
discord
docker
docker-compose
docker-machine
filezilla
firacode
Firefox
git
git.commandline
gitextensions
inconsolata
jdk8
JabRef
libreoffice
miktex
nmap
NSClientPlusPlus.x64
poshgit
procexp
putty
r.project
r.studio
SublimeText3.app
sysinternals
texstudio
TortoiseGit
totalcommander
virtualbox
vagrant
vagrant-winrm-config
vim
vlc
windirstat
winrar
wireshark
# Name: WindowsBootstrap.ps1
# Description: Boxstarter bootstrap script for basic Windows Server configuration
# Author: Bert Van Vreckem <bert.vanvreckem@gmail.com>
#
# See also:
# - https://blog.jessfraz.com/post/windows-for-linux-nerds/
#--- Remote management ---
# Enable Ansible Remoting
$scriptPath = ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/ansible/ansible/devel/examples/scripts/ConfigureRemotingForAnsible.ps1'))
Invoke-Command -ScriptBlock ([scriptblock]::Create($scriptPath)) -ArgumentList "-Verbose -SkipNetworkProfileCheck -CertValidityDays 2492"
# Enable Remote Desktop
(Get-WmiObject Win32_TerminalServiceSetting -Namespace root\cimv2\TerminalServices).SetAllowTsConnections(1,1) | Out-Null
(Get-WmiObject -Class "Win32_TSGeneralSetting" -Namespace root\cimv2\TerminalServices -Filter "TerminalName='RDP-tcp'").SetUserAuthenticationRequired(0) | Out-Null
Get-NetFirewallRule -DisplayName "Remote Desktop*" | Set-NetFirewallRule -enabled true
# Allow Ping
Get-NetFirewallRule -DisplayName "*Echo Request*" | Set-NetFirewallRule -enabled true
#--- Windows settings ---
Set-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced -Name NavPaneExpandToCurrentFolder -Value 1
Set-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced -Name NavPaneShowAllFolders -Value 1
Set-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced -Name LaunchTo -Value 1
Set-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced -Name MMTaskbarMode -Value 2
# Enable Windows SmartScreen
Set-ItemProperty -Path Registry::HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer -Name "SmartScreenEnabled" -Value "RequireAdmin"
# Disable Shutdown Event Tracker
New-ItemProperty -Force -Path Registry::HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Reliability -Name "ShutdownReasonUI" -PropertyType DWord -Value 1
#--- Package installation ---
# Install Chocolatey
iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
choco install -y Microsoft-Windows-Subsystem-Linux -source windowsfeatures
choco install -y git -params '"/GitAndUnixToolsOnPath /WindowsTerminal"'
# Install/Upgrade software listed in choco-packages.txt with Chocolatey
$packages = Get-Content ".\choco-packages.txt"
foreach($package in $packages) {
Write-Host "Package $package"
choco install --yes $package
}
del c:\Users\Public\Desktop\*.lnk
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment