PortValhalla/scripts/Windows/OS/Install.ps1

79 lines
2.9 KiB
PowerShell
Raw Normal View History

2023-07-12 20:37:31 +00:00
#!/bin/pwsh
2023-06-16 18:24:22 +00:00
. "$PSScriptRoot/Manage.ps1";
2023-06-22 15:06:45 +00:00
. "$PSScriptRoot/Upgrade.ps1";
2023-06-22 20:56:43 +00:00
. "$PSScriptRoot/User.ps1";
2023-06-22 15:53:12 +00:00
. "$PSScriptRoot/../Scripts/Context.ps1";
. "$PSScriptRoot/../Software/Firefox/Install.ps1";
2023-06-16 18:24:22 +00:00
2023-06-21 20:04:18 +00:00
function Invoke-WindowsInstallation([Context] $context)
{
2023-07-26 12:56:17 +00:00
$configPath = "$PSScriptRoot/../Config";
$softwarePath = "$PSScriptRoot/../Software";
2023-07-16 10:56:54 +00:00
if (-not $context.Get("InitialConfiguration")) {
2023-07-19 21:19:05 +00:00
$null = Enable-WindowsOptionalFeature -Online -All -FeatureName "NetFx3";
2023-07-18 21:33:53 +00:00
2023-07-17 14:02:33 +00:00
. "$configPath/Windows/Install.ps1" $context;
. "$configPath/Explorer/Install.ps1" $context;
. "$configPath/OpenSSH/Install.ps1" $context;
. "$configPath/chocolatey/Install.ps1";
. "$configPath/PowerShell/Install.ps1" $context;
2023-07-16 13:37:18 +00:00
$context.RemoveDesktopIcon("*Microsoft Edge*");
2023-07-16 10:56:54 +00:00
$context.Set("InitialConfiguration", 1, "DWord");
}
2023-07-14 07:24:13 +00:00
Write-Host "Starting Installation and Restoration of Windows";
Update-WindowsInstallation $context;
2023-07-15 16:24:26 +00:00
if (-not $context.Get("SoftwarePrerequisitesInstalled")) {
Write-Host "Installing prerequisites for installing software";
2023-07-15 16:45:44 +00:00
Install-Module -AcceptLicense -Force "NuGet";
2023-07-15 16:24:26 +00:00
Import-Module NuGet;
Install-Firefox $context;
choco install -y selenium-gecko-driver;
2023-07-19 21:19:05 +00:00
$null = Install-Package -Force Selenium.WebDriver -SkipDependencies;
2023-07-15 16:24:26 +00:00
2023-07-17 19:57:01 +00:00
winget install --accept-source-agreements --accept-package-agreements -e --id AutoHotkey.AutoHotkey;
2023-07-16 22:17:15 +00:00
2023-07-15 23:27:38 +00:00
$context.Set("SoftwarePrerequisitesInstalled", 1, "DWord");
2023-07-15 16:24:26 +00:00
}
2023-07-14 07:24:13 +00:00
if (-not $context.Get("DriversInstalled")) {
Write-Host "Installing Drivers";
Write-Information "Looking for driver installation function";
2023-07-15 09:33:42 +00:00
if ((Get-Command Install-PortValhallaDrivers -ErrorAction SilentlyContinue)) {
2023-07-14 07:24:13 +00:00
Write-Information "Driver installation function was found. Starting installation";
2023-07-15 09:33:42 +00:00
Install-PortValhallaDrivers $context;
2023-07-14 07:24:13 +00:00
}
Write-Information "Finished installing drivers";
2023-07-15 23:27:38 +00:00
$context.Set("DriversInstalled", 1, "DWord");
2023-07-15 19:40:14 +00:00
$context.Reboot();
exit;
2023-07-14 07:24:13 +00:00
}
if (-not $context.Get("MachineWideSoftware")) {
Write-Host "Setting up software with default app associations";
. "$softwarePath/WinSCP/Install.ps1" $context;
. "$softwarePath/Thunderbird/Install.ps1" $context;
. "$softwarePath/posh-git/Install.ps1" $context;
2023-07-27 00:36:31 +00:00
. "$softwarePath/Terminal-Icons/Install.ps1" $context;
2023-07-27 00:57:35 +00:00
. "$softwarePath/Oh My Posh/Install.ps1" $context;
$context.Set("MachineWideSoftware", 1, "DWord");
}
2023-06-22 20:56:43 +00:00
New-PersonalUser $context;
2023-06-30 10:19:54 +00:00
Restore-WindowsInstallation $context;
Uninstall-Package -Force Selenium.WebDriver;
Uninstall-Module -Force "NuGet";
choco uninstall -y selenium-gecko-driver;
winget uninstall --force AutoHotkey.AutoHotkey;
Set-Location ~;
Remove-Item -Recurse "$PSScriptRoot/../../..";
2023-06-21 20:04:18 +00:00
}