-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSetup.ps1
44 lines (32 loc) · 1003 Bytes
/
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
. $PSScriptRoot\functions.ps1
try
{
Write-Host "Checking for PowerShell Core..."
pwsh -v
Write-Host "PowerShell Core is installed."
}
catch
{
Write-Host "PowerShell Core is not installed. Installing ..."
Start-WithStatus "Installing PowerShell Core" {
# Get the latest download URL
$URL = Invoke-RestMethod -Uri "https://api.github.com/repos/PowerShell/PowerShell/releases/latest"
$URL = $URL.assets.browser_download_url -match 'win-x64.msi'
Write-Output "Downloading $URL ..."
# Define the destination
$destination = "$env:TEMP\\PowerShell-latest.msi"
Invoke-WebRequest -Uri "$URL" -OutFile $destination
Start-Process -FilePath msiexec.exe -ArgumentList "/i $destination /qn /norestart" -Wait -NoNewWindow
Remove-Item $destination
}
}
try
{
Write-Host "Checking for Winget..."
winget --version
Write-Host "Winget is installed."
}
catch
{
Write-Host "Winget is not installed."
}