-
Notifications
You must be signed in to change notification settings - Fork 6
/
Install.ps1
56 lines (47 loc) · 1.2 KB
/
Install.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
Function Test-CommandExists
{
Param ($command)
try { if (Get-Command $command) { RETURN $true } }
Catch { RETURN $false }
}
[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor [System.Net.SecurityProtocolType]::Tls12
$ErrorActionPreference = 'stop'
if (!(Test-CommandExists winget))
{
echo "Installing latest winget..."
$DownloadURL = 'https://github.com/microsoft/winget-cli/releases/latest/download/Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.msixbundle'
$FilePath = "$env:TEMP\WinGet.msixbundle"
try
{
Invoke-WebRequest -Uri $DownloadURL -UseBasicParsing -OutFile $FilePath
}
catch
{
Write-Error $_
Return
}
if (Test-Path $FilePath)
{
Add-AppxPackage $FilePath
$item = Get-Item -LiteralPath $FilePath
$item.Delete()
}
}
echo "Downloading script..."
$DownloadURL = 'https://github.com/harryeffinpotter/PC-Gaming-Redists-AIO/raw/main/AIOInstaller.bat'
$FilePath = "$env:TEMP\AIOInstaller.bat"
try
{
Invoke-WebRequest -Uri $DownloadURL -UseBasicParsing -OutFile $FilePath
}
catch
{
Write-Error $_
Return
}
if (Test-Path $FilePath)
{
Start-Process -Verb runAs $FilePath -Wait
$item = Get-Item -LiteralPath $FilePath
$item.Delete()
}