-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbootstrap.ps1
More file actions
60 lines (47 loc) · 2.17 KB
/
bootstrap.ps1
File metadata and controls
60 lines (47 loc) · 2.17 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
function Verify-Elevated {
# Get the ID and security principal of the current user account
$myIdentity = [System.Security.Principal.WindowsIdentity]::GetCurrent()
$myPrincipal = New-Object System.Security.Principal.WindowsPrincipal ($myIdentity)
# Check to see if we are currently running "as Administrator"
return $myPrincipal.IsInRole([System.Security.Principal.WindowsBuiltInRole]::Administrator)
}
# Check to see if we are currently running "as Administrator"
if (!(Verify-Elevated)) {
$newProcess = New-Object System.Diagnostics.ProcessStartInfo "PowerShell";
$newProcess.Arguments = $myInvocation.MyCommand.Definition;
$newProcess.Verb = "runas";
[System.Diagnostics.Process]::Start($newProcess);
exit
}
if (!(Get-Command "choco.exe" -ErrorAction SilentlyContinue)) {
Write-Host "Installing Chocolatey"
Invoke-WebRequest https://chocolatey.org/install.ps1 -UseBasicParsing | Invoke-Expression
# Make `refreshenv` available right away, by defining the $env:ChocolateyInstall variable
# and importing the Chocolatey profile module.
$env:ChocolateyInstall = Convert-Path "$((Get-Command choco).path)\..\.."
Import-Module "$env:ChocolateyInstall\helpers\chocolateyProfile.psm1"
refreshenv
}
if (!(Get-Command "git.exe" -ErrorAction SilentlyContinue)) {
Write-Host "Installing git"
choco install -y git -params '"/GitAndUnixToolsOnPath"'
refreshenv
# git perf tweaks
git config --global core.preloadindex true
git config --global core.fscache true
git config --global gc.auto 256
}
$repoPath = "c:\git"
$bootstrapperPath = "$repoPath/bootstrapper"
if (!(Test-Path $bootstrapperPath)) {
New-Item $bootstrapperPath -ItemType Directory
Push-Location $bootstrapperPath
git clone https://github.com/michaelgriscom/bootstrapper.git .
Pop-Location
}
Write-Host "Installing applications" -ForegroundColor "Yellow"
Invoke-Expression $bootstrapperPath/install-apps.ps1
Write-Host "Removing bloatware" -ForegroundColor "Yellow"
Invoke-Expression $bootstrapperPath/remove-bloatware.ps1
Write-Host "Configuring Windows" -ForegroundColor "Yellow"
Invoke-Expression $bootstrapperPath/configure-windows-settings.ps1