/
bootstrap.ps1
28 lines (23 loc) · 1.05 KB
/
bootstrap.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
Set-StrictMode -Version Latest
$ErrorActionPreference = "Stop"
function Create-TempDirectory {
$path = Join-Path ([IO.Path]::GetTempPath()) ([IO.Path]::GetRandomFileName())
New-Item $path -Type Directory
}
function Create-ShellFolder($path) {
(New-Object -COM Shell.Application).NameSpace($path)
}
function Unzip-Files($zipPath, $destinationPath) {
$zipPackage = Create-ShellFolder $zipPath
$destination = Create-ShellFolder $destinationPath
$destination.CopyHere($zipPackage.Items(), 0x10)
}
$tempDir = Create-TempDirectory
$client = New-Object Net.WebClient
$zip = Join-Path $tempDir.FullName winbootstrap.zip
$client.DownloadFile("https://github.com/aroben/winbootstrap/zipball/master", $zip)
Unzip-Files $zip $tempDir.FullName
Start-Sleep -Seconds 1
$install = (Resolve-Path (Join-Path $tempDir.FullName "*\install.ps1")).Path
powershell -ExecutionPolicy Bypass -File $install > C:\Users\Administrator\winbootstrap.log 2>C:\Users\Administrator\winbootstrap-error.log
"Your computer is now bootstrapped. Reboot now, or save a VM image for easy duplication."