-
Notifications
You must be signed in to change notification settings - Fork 0
/
_setup.ps1
79 lines (63 loc) · 2.27 KB
/
_setup.ps1
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
# Install the OpenSSH Client
Add-WindowsCapability -Online -Name OpenSSH.Client~~~~0.0.1.0
# Install the OpenSSH Server
Add-WindowsCapability -Online -Name OpenSSH.Server~~~~0.0.1.0
# Start the sshd service
Start-Service sshd
#
# OPTIONAL but recommended:
Set-Service -Name sshd -StartupType 'Automatic'
#
# Confirm the firewall rule is configured. It should be created automatically by setup.
Get-NetFirewallRule -Name *ssh*
#
# There should be a firewall rule named "OpenSSH-Server-In-TCP", which should be enabled
# If the firewall does not exist, create one
New-NetFirewallRule -Name sshd -DisplayName 'OpenSSH Server (sshd)' -Enabled True -Direction Inbound -Protocol TCP -Action Allow -LocalPort 22 -ErrorAction Ignore
New-ItemProperty -Path "HKLM:\SOFTWARE\OpenSSH" -Name DefaultShell -Value "C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe" -PropertyType String -Force
powershell -nologo -noprofile -command Set-ExecutionPolicy bypass -force
if ($null -eq (get-command choco*))
{
iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
choco feature enable -n allowGlobalConfirmation
}
if ($null -eq (get-command git*))
{
choco install git
}
$env:path+=(";"+"C:\Program Files\Git\bin\")
$_psHOME=($env:HOMEDRIVE+$env:HOMEPATH+"\Documents\")
$_psD = Split-path $profile
$_psDWin = ($_psHOME+"WindowsPowerShell")
$_psDCore = ($_psHOME+"PowerShell")
if (!(Test-path $profile))
{
git clone --recursive https://github.com/ocalvo/MyPowerShell.git $_psD
}
if ("Core" -eq $PSEdition) {
if (!(Test-path $_psDWin))
{
new-Item $_psDWin -ItemType SymbolicLink -Target $_psDCore
}
cd $_psDCore
} else {
if (!(Test-path $_psDCore))
{
new-Item $_psDCore -ItemType SymbolicLink -Target $_psDWin
}
cd $_psDWin
}
git submodule update --init .\vimfiles\
git submodule update --init .\Modules\PwrRazzle
git submodule update --init .\Modules\PwrSudo
git submodule update --init .\Modules\PwrSearch
choco install microsoft-windows-terminal --pre
choco install cascadiafonts
choco install pwsh
If (Test-Path "C:\Program Files\openssh-win64\Set-SSHDefaultShell.ps1") {
& "C:\Program Files\openssh-win64\Set-SSHDefaultShell.ps1"
}
.$profile
.\Set-GitConfig.ps1
$tSettings = $_psD+"\WinTerminal\settings.json"
cp $tSettings $terminalSettings