-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup_windows_vm.ps1
More file actions
136 lines (120 loc) · 3.91 KB
/
Copy pathsetup_windows_vm.ps1
File metadata and controls
136 lines (120 loc) · 3.91 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
<# Instruction
0. Finish all available Windows update (Preferably also activiate Windows)
1. Update the `App Installer` in Microsoft Store
2. Start an elevated Powershell prompt, run `Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Force`, then run this script
TODO:
- Add error handling
#>
if (Test-Path env:TEMP) {
Push-Location $env:TEMP
}
elseif (Test-Path env:tmp) {
Push-Location $env:TMP
}
else {
Write-Host "No temp folder in PATH, quitting..."
exit 1
}
# Uninstall bloatware
Write-Host "Uninstalling bloatware..."
$bloatwares = @(
"Microsoft.Microsoft3DViewer",
"Microsoft.WindowsAlarms",
# Mail, Calendar
"Microsoft.windowscommunicationsapps",
# Cortana
"Microsoft.549981C3F5F10",
"Microsoft.WindowsFeedbackHub",
# Groove Music
"Microsoft.ZuneMusic",
# Movies & TV
"Microsoft.ZuneVideo",
# Paint 3D
"Microsoft.MSPaint",
"Microsoft.WindowsMaps",
"Microsoft.MicrosoftSolitaireCollection",
"Microsoft.MixedReality.Portal",
"Microsoft.Office.OneNote",
"Microsoft.MicrosoftOfficeHub",
"Microsoft.XboxApp",
"Microsoft.BingWeather",
"Microsoft.MicrosoftStickyNotes",
"Microsoft.SkypeApp",
"Microsoft.ScreenSketch",
"Microsoft.People",
"Microsoft.Windows.Photos",
"Microsoft.WindowsSoundRecorder",
"Microsoft.WindowsCamera"
)
foreach ($bloatware in $bloatwares) {
Get-AppxPackage $bloatware | Remove-AppxPackage
}
# Check for winget
try {
# Powershell try-catch works only when the error is terminating
Get-Command winget -ErrorAction Stop
}
catch {
Write-Host "Winget not found, please update the `App Installer` in Microsoft Store!"
exit 1
}
# Install packages
Write-Host "Installing common packages..."
$packages = @(
"7zip.7zip",
"Apple.iTunes",
"BurntSushi.ripgrep.MSVC",
"Citrix.Workspace",
"dandavison.delta",
"Discord.Discord",
"DuongDieuPhap.ImageGlass",
"FiloSottile.age",
"Git.Git",
"gerardog.gsudo",
"JanDeDobbeleer.OhMyPosh",
"jdx.mise",
"jftuga.less",
"junegunn.fzf",
"MartiCliment.UniGetUI",
"Microsoft.PowerShell",
"Microsoft.WindowsTerminal",
"Mozilla.Firefox",
"Notepad++.Notepad++",
"OBSProject.OBSStudio",
"okibcn.nano",
"PeterPawlowski.foobar2000",
"qBittorrent.qBittorrent",
"RaspberryPiFoundation.RaspberryPiImager",
"sharkdp.fd",
"TheDocumentFoundation.LibreOffice",
"twpayne.chezmoi",
"Valve.Steam",
"VideoLAN.VLC"
)
foreach ($package in $packages) {
winget install --id=$package -e --accept-package-agreements --accept-source-agreements --source winget
}
# Reload PATH
$env:Path = [System.Environment]::GetEnvironmentVariable("Path", "Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path", "User")
# fzf bindings
pwsh -command "Install-Module -Name PSFzf -Repository PSGallery -Scope CurrentUser -Force"
# Setup Chezmoi
chezmoi init --apply --force regunakyle
oh-my-posh font install NerdFontsSymbolsOnly
mise install
# SSH server
Add-WindowsCapability -Online -Name OpenSSH.Client~~~~0.0.1.0
Add-WindowsCapability -Online -Name OpenSSH.Server~~~~0.0.1.0
Set-Service -Name sshd -StartupType 'Automatic'
# Confirm the Firewall rule is configured. It should be created automatically by setup.
if (!(Get-NetFirewallRule -Name "OpenSSH-Server-In-TCP" -ErrorAction SilentlyContinue | Select-Object Name, Enabled)) {
Write-Output "Firewall Rule 'OpenSSH-Server-In-TCP' does not exist, creating it..."
New-NetFirewallRule -Name 'OpenSSH-Server-In-TCP' -DisplayName 'OpenSSH Server (sshd)' -Enabled True -Direction Inbound -Protocol TCP -Action Allow -LocalPort 22
}
else {
Write-Output "Firewall rule 'OpenSSH-Server-In-TCP' has been created and exists."
}
# https://github.com/microsoft/winget-pkgs/issues/140696
Write-Host "You should install the Nvidia App manually."
Write-Host "Installation finished! You should reboot now to avoid stability problems."
Pop-Location