-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy path1.Setup.ps1
51 lines (38 loc) · 1.5 KB
/
1.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
. $PSScriptRoot\functions.ps1
Write-Output "Powershell edition: $($PSVersionTable.PSEdition)"
Start-WithStatus "Applying Timezone Redirecting settings" { & $PSScriptRoot\avd\TimezoneRedirection.ps1 }
Start-WithStatus "Applying Windows Optimizations" { & $PSScriptRoot\vdot\Windows_VDOT.ps1 -Optimizations All -AdvancedOptimizations Edge, RemoveLegacyIE -AcceptEULA }
Start-WithStatus "Creating DevDrive" {
& $PSScriptRoot\Create-DevDrive.ps1 -DriveLetter 'E' # Because D is already taken by the DVD drive
}
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."
}