2023-07-12 20:37:31 +00:00
|
|
|
#!/bin/pwsh
|
2024-08-09 02:19:49 +00:00
|
|
|
using namespace System.Security.Principal;
|
|
|
|
|
2024-03-23 16:53:43 +00:00
|
|
|
. "$PSScriptRoot/../Scripts/Prerequisites.ps1";
|
|
|
|
|
2023-06-16 18:24:22 +00:00
|
|
|
. "$PSScriptRoot/Manage.ps1";
|
2024-03-23 14:38:06 +00:00
|
|
|
. "$PSScriptRoot/User/Install.ps1";
|
2024-08-09 12:45:29 +00:00
|
|
|
. "$PSScriptRoot/../Scripts/Security.ps1";
|
2024-08-26 21:33:46 +00:00
|
|
|
. "$PSScriptRoot/../Scripts/WSL.ps1";
|
2023-07-16 10:39:07 +00:00
|
|
|
. "$PSScriptRoot/../Software/Firefox/Install.ps1";
|
2024-08-07 19:05:32 +00:00
|
|
|
. "$PSScriptRoot/../../Common/Scripts/Context.ps1";
|
2023-06-16 18:24:22 +00:00
|
|
|
|
2024-08-01 17:02:12 +00:00
|
|
|
$null = New-Module {
|
2024-08-01 19:49:46 +00:00
|
|
|
. "$PSScriptRoot/../Scripts/Hooks.ps1";
|
|
|
|
. "$PSScriptRoot/../Scripts/PowerManagement.ps1";
|
2024-08-09 02:19:49 +00:00
|
|
|
. "$PSScriptRoot/../Scripts/Registry.ps1";
|
2024-08-09 14:02:33 +00:00
|
|
|
. "$PSScriptRoot/../Scripts/Security.ps1";
|
2024-08-01 19:49:46 +00:00
|
|
|
. "$PSScriptRoot/../Scripts/Update.ps1";
|
2024-08-08 15:49:43 +00:00
|
|
|
. "$PSScriptRoot/../Scripts/Users.ps1";
|
2024-08-07 19:05:32 +00:00
|
|
|
. "$PSScriptRoot/../../Common/Scripts/Config.ps1";
|
|
|
|
. "$PSScriptRoot/../../Common/Scripts/Operations.ps1";
|
|
|
|
. "$PSScriptRoot/../../Common/Scripts/Software.ps1";
|
|
|
|
. "$PSScriptRoot/../../Common/Scripts/SoftwareManagement.ps1";
|
|
|
|
. "$PSScriptRoot/../../Common/Types/InstallerAction.ps1";
|
2024-08-01 19:32:33 +00:00
|
|
|
|
2024-08-01 17:02:12 +00:00
|
|
|
<#
|
|
|
|
.SYNOPSIS
|
|
|
|
Finishes the installation of a running Windows machine.
|
|
|
|
#>
|
|
|
|
function Start-WindowsInstallation {
|
2024-08-24 14:52:41 +00:00
|
|
|
Start-Operation -NoImplicitCleanup {
|
2024-08-05 21:09:58 +00:00
|
|
|
Start-InstallationLoop;
|
|
|
|
};
|
2024-08-01 17:02:12 +00:00
|
|
|
}
|
2024-07-31 14:15:09 +00:00
|
|
|
|
2024-08-01 17:02:12 +00:00
|
|
|
<#
|
|
|
|
.SYNOPSIS
|
|
|
|
Starts the installation loop.
|
|
|
|
#>
|
|
|
|
function Start-InstallationLoop {
|
|
|
|
while (-not (Get-IsFinished)) {
|
2024-08-27 12:05:16 +00:00
|
|
|
if (Test-Admin) {
|
|
|
|
$null = Import-Module PSWindowsUpdate;
|
2024-08-21 21:21:32 +00:00
|
|
|
|
2024-08-27 12:05:16 +00:00
|
|
|
Invoke-Hook "Invoke-WindowsUpdate" -Fallback {
|
|
|
|
Update-WindowsInstallation;
|
|
|
|
};
|
2024-08-16 13:21:41 +00:00
|
|
|
|
2024-08-27 12:05:16 +00:00
|
|
|
if ((Get-WURebootStatus -Silent)) {
|
|
|
|
Restart-Intermediate;
|
|
|
|
return;
|
2024-08-27 02:15:37 +00:00
|
|
|
}
|
2024-08-27 12:05:16 +00:00
|
|
|
}
|
2024-08-16 13:21:41 +00:00
|
|
|
|
2024-08-27 12:05:16 +00:00
|
|
|
<#
|
|
|
|
.SYNOPSIS
|
|
|
|
Deploys an action for each software.
|
|
|
|
|
|
|
|
.PARAMETER Action
|
|
|
|
The action to execute by default.
|
|
|
|
#>
|
|
|
|
function Deploy-SoftwareAction {
|
|
|
|
param(
|
|
|
|
[Nullable[InstallerAction]] $Action = $null
|
|
|
|
)
|
|
|
|
|
|
|
|
[bool] $install = $false;
|
|
|
|
$arguments = [hashtable]@{ };
|
|
|
|
|
|
|
|
if ($null -ne $Action) {
|
|
|
|
$install = ($Action -eq ([InstallerAction]::Install));
|
|
|
|
$null = $arguments.Add("action", $Action);
|
|
|
|
} else {
|
|
|
|
$install = $true;
|
|
|
|
}
|
2024-08-21 21:21:32 +00:00
|
|
|
|
2024-08-27 12:05:16 +00:00
|
|
|
# Drivers
|
|
|
|
& {
|
|
|
|
$driverPath = "$PSScriptRoot/../Drivers";
|
|
|
|
$mbPath = "$driverPath/ROG Zenith Extreme Alpha";
|
|
|
|
|
|
|
|
if ($install) {
|
|
|
|
if (Get-Config "valhalla.hardware.elgatoWave") {
|
|
|
|
if (-not (Test-ChocoPackage wavelink)) {
|
|
|
|
Install-ChocoPackage wavelink -ArgumentList '--install-arguments="/norestart"';
|
|
|
|
Remove-DesktopIcon "*Wave Link*";
|
|
|
|
Restart-Intermediate;
|
|
|
|
exit;
|
|
|
|
}
|
2024-08-16 13:21:41 +00:00
|
|
|
}
|
2024-08-21 21:21:32 +00:00
|
|
|
}
|
2024-08-16 13:21:41 +00:00
|
|
|
|
2024-08-27 12:05:16 +00:00
|
|
|
foreach ($component in (Get-Config "valhalla.hardware.components")) {
|
|
|
|
switch ($component) {
|
|
|
|
("ROG Zenith Extreme Alpha") {
|
|
|
|
& "$mbPath/MarvellEthernet/Manage.ps1" @arguments;
|
|
|
|
& "$mbPath/IntelWiFi/Manage.ps1" @arguments;
|
|
|
|
& "$mbPath/IntelBluetooth/Manage.ps1" @arguments;
|
|
|
|
& "$mbPath/AMDChipsetX399/Manage.ps1" @arguments;
|
|
|
|
& "$driverPath/AMDChipsetX399/Manage.ps1" @arguments;
|
|
|
|
}
|
|
|
|
("Predator Z301C") {
|
|
|
|
& "$driverPath/Predator Z301C/Manage.ps1" @arguments;
|
|
|
|
}
|
2024-08-27 02:15:37 +00:00
|
|
|
}
|
2024-08-27 12:05:16 +00:00
|
|
|
}
|
2024-08-22 09:11:00 +00:00
|
|
|
|
2024-08-27 12:05:16 +00:00
|
|
|
if ($install) {
|
|
|
|
if (Get-Config "valhalla.hardware.amdCPU") {
|
|
|
|
Install-ChocoPackage amd-ryzen-master;
|
|
|
|
# ToDo: backup Ryzen energy saving plan
|
|
|
|
}
|
2024-08-08 20:08:13 +00:00
|
|
|
|
2024-08-27 12:05:16 +00:00
|
|
|
if (Get-Config "valhalla.hardware.nvidiaGPU") {
|
|
|
|
Install-ChocoPackage geforce-game-ready-driver;
|
|
|
|
Remove-DesktopIcon "*Geforce*";
|
|
|
|
}
|
2024-08-01 00:59:32 +00:00
|
|
|
|
2024-08-27 12:05:16 +00:00
|
|
|
if (Get-Config "valhalla.hardware.corsairDevice") {
|
|
|
|
Install-ChocoPackage icue;
|
|
|
|
}
|
|
|
|
}
|
2024-08-08 11:17:14 +00:00
|
|
|
|
2024-08-27 12:05:16 +00:00
|
|
|
if (Get-Config "valhalla.hardware.eyeX") {
|
|
|
|
& "$driverPath/Tobii EyeX/Manage.ps1" @arguments;
|
|
|
|
}
|
|
|
|
};
|
2024-08-08 21:03:10 +00:00
|
|
|
|
2024-08-27 12:05:16 +00:00
|
|
|
& {
|
|
|
|
# Windows Config
|
|
|
|
$softwarePath = "$PSScriptRoot/../Software";
|
|
|
|
$commonSoftware = "$PSScriptRoot/../../Common/Software";
|
|
|
|
& "$softwarePath/Windows/Manage.ps1" @arguments;
|
2024-08-26 22:45:46 +00:00
|
|
|
|
2024-08-27 12:05:16 +00:00
|
|
|
if (Get-Config "valhalla.hardware.logitechG") {
|
|
|
|
& "$softwarePath/LGHub/Manage.ps1" @arguments;
|
|
|
|
}
|
2024-08-01 00:59:32 +00:00
|
|
|
|
2024-08-27 12:05:16 +00:00
|
|
|
if (Test-Collection "essential") {
|
|
|
|
# Essentials
|
|
|
|
& "$softwarePath/aliae/Main.ps1" @arguments;
|
|
|
|
& "$softwarePath/git/Manage.ps1" @arguments;
|
|
|
|
& "$softwarePath/OpenSSH/Manage.ps1" @arguments;
|
|
|
|
& "$softwarePath/PowerShell/Manage.ps1" @arguments;
|
|
|
|
& "$softwarePath/chocolatey/Manage.ps1" @arguments;
|
|
|
|
& "$softwarePath/zoxide/Manage.ps1" @arguments;
|
|
|
|
& "$commonSoftware/posh-git/Manage.ps1" @arguments;
|
|
|
|
& "$commonSoftware/Terminal-Icons/Manage.ps1" @arguments;
|
|
|
|
& "$softwarePath/Oh My Posh/Manage.ps1" @arguments;
|
|
|
|
|
|
|
|
if (Get-Config "valhalla.windows.dualboot") {
|
|
|
|
& "$softwarePath/Ext4Fsd/Main.ps1" @arguments;
|
|
|
|
}
|
2024-08-09 14:02:33 +00:00
|
|
|
|
2024-08-27 12:05:16 +00:00
|
|
|
if ($install) {
|
|
|
|
Install-ChocoPackage `
|
|
|
|
procexp `
|
|
|
|
procmon `
|
|
|
|
;
|
2024-08-09 11:34:46 +00:00
|
|
|
|
2024-08-27 12:05:16 +00:00
|
|
|
Install-WingetPackage `
|
|
|
|
KDE.KDEConnect `
|
|
|
|
;
|
|
|
|
}
|
|
|
|
}
|
2024-08-01 14:32:03 +00:00
|
|
|
|
2024-08-27 12:05:16 +00:00
|
|
|
if (Test-Collection "common") {
|
|
|
|
# Common Software
|
|
|
|
& "$softwarePath/WinSCP/Manage.ps1" @arguments;
|
|
|
|
& "$softwarePath/Thunderbird/Manage.ps1" @arguments;
|
|
|
|
& "$softwarePath/PuTTY/Manage.ps1" @arguments;
|
|
|
|
|
|
|
|
if ($install) {
|
|
|
|
Install-ChocoPackage `
|
|
|
|
7zip `
|
|
|
|
chocolateygui `
|
|
|
|
DefaultProgramsEditor `
|
|
|
|
bitwarden `
|
|
|
|
keepass `
|
|
|
|
;
|
|
|
|
|
|
|
|
Install-WingetPackage `
|
|
|
|
SomePythonThings.WingetUIStore `
|
|
|
|
;
|
|
|
|
|
|
|
|
Remove-DesktopIcon "UniGetUI*";
|
|
|
|
}
|
|
|
|
}
|
2024-08-06 14:54:11 +00:00
|
|
|
|
2024-08-27 12:05:16 +00:00
|
|
|
if (Test-Collection "desktopExperience") {
|
|
|
|
if ($install) {
|
|
|
|
# Fonts
|
|
|
|
Install-ChocoPackage nerd-fonts-CascadiaCode;
|
|
|
|
|
|
|
|
# Internet Access
|
|
|
|
Install-WingetPackage Brave.Brave kamranahmedse.pennywise;
|
|
|
|
Remove-DesktopIcon "*Brave*";
|
|
|
|
Remove-TaskbarItem "*Brave*";
|
|
|
|
Remove-DesktopIcon "Pennywise*";
|
|
|
|
|
|
|
|
# Tools
|
|
|
|
Install-SetupPackage -Source "https://github.com/mRemoteNG/mRemoteNG/releases/download/2023.03.03-v1.77.3-nb/mRemoteNG-Installer-1.77.3.nb-1784.msi" -ArgumentList "/Quiet";
|
|
|
|
Remove-DesktopIcon "mRemoteNG*";
|
|
|
|
|
|
|
|
Install-ChocoPackage `
|
|
|
|
gimp `
|
|
|
|
gpu-z `
|
|
|
|
windirstat `
|
|
|
|
winmerge `
|
|
|
|
handbrake `
|
|
|
|
hwmonitor `
|
|
|
|
qbittorrent `
|
|
|
|
imgburn `
|
|
|
|
inkscape `
|
|
|
|
krita `
|
|
|
|
MetaX `
|
|
|
|
obs-studio `
|
|
|
|
;
|
|
|
|
|
|
|
|
Remove-DesktopIcon "GIMP*";
|
|
|
|
Remove-DesktopIcon "GPU-Z*";
|
|
|
|
Remove-DesktopIcon "WinDirStat*";
|
|
|
|
Remove-DesktopIcon "*HWMonitor*";
|
|
|
|
Remove-DesktopIcon "ImgBurn*";
|
|
|
|
Remove-DesktopIcon "InkScape*";
|
|
|
|
Remove-DesktopIcon "Krita*";
|
|
|
|
Remove-DesktopIcon "MetaX*";
|
|
|
|
Remove-DesktopIcon "OBS Studio*";
|
|
|
|
|
|
|
|
Install-WingetPackage `
|
|
|
|
AntSoftware.AntRenamer `
|
|
|
|
AppWork.JDownloader;
|
|
|
|
|
|
|
|
Remove-DesktopIcon "JDownloader*";
|
|
|
|
}
|
2024-08-09 11:34:46 +00:00
|
|
|
|
2024-08-27 12:05:16 +00:00
|
|
|
# ToDo: Consider hiding behind own config?
|
|
|
|
& "$softwarePath/Ubiquiti UniFi Controller/Manage.ps1" @arguments;
|
2024-08-07 14:17:49 +00:00
|
|
|
|
2024-08-27 12:05:16 +00:00
|
|
|
# Internet Access
|
|
|
|
& "$softwarePath/Firefox/Manage.ps1" @arguments;
|
|
|
|
& "$softwarePath/MSEdgeRedirect/Manage.ps1" @arguments;
|
2024-08-07 16:30:14 +00:00
|
|
|
|
2024-08-27 12:05:16 +00:00
|
|
|
if (Test-Collection "fileSync") {
|
|
|
|
& "$softwarePath/Nextcloud/Main.ps1" @arguments;
|
|
|
|
}
|
|
|
|
}
|
2024-08-08 02:36:35 +00:00
|
|
|
|
2024-08-27 12:05:16 +00:00
|
|
|
if (Test-Collection "socialMedia") {
|
|
|
|
if ($install) {
|
|
|
|
Install-ChocoPackage `
|
|
|
|
signal `
|
|
|
|
threema-desktop `
|
|
|
|
element-desktop `
|
|
|
|
teamspeak `
|
|
|
|
;
|
2024-08-07 21:53:12 +00:00
|
|
|
|
2024-08-27 12:05:16 +00:00
|
|
|
Remove-DesktopIcon "*Element*";
|
|
|
|
Remove-DesktopIcon "*TeamSpeak*";
|
2024-08-08 02:36:35 +00:00
|
|
|
|
2024-08-27 12:05:16 +00:00
|
|
|
Install-WingetPackage Discord.Discord;
|
|
|
|
Remove-DesktopIcon "*Discord*";
|
|
|
|
}
|
|
|
|
}
|
2024-08-08 02:36:35 +00:00
|
|
|
|
2024-08-27 12:05:16 +00:00
|
|
|
if (Test-Collection "media") {
|
|
|
|
if ($install) {
|
|
|
|
Install-ChocoPackage `
|
|
|
|
k-litecodecpackmega `
|
|
|
|
vlc `
|
|
|
|
;
|
|
|
|
|
|
|
|
Remove-DesktopIcon "VLC*";
|
|
|
|
Install-ChocoPackage jellyfin-media-player -ArgumentList "--install-args","/norestart";
|
|
|
|
Remove-DesktopIcon "Jellyfin Media Player*";
|
|
|
|
Install-WingetPackage Ytmdesktop.Ytmdesktop;
|
|
|
|
Remove-DesktopIcon "Youtube Music*";
|
|
|
|
}
|
|
|
|
}
|
2024-08-07 21:53:12 +00:00
|
|
|
|
2024-08-27 12:05:16 +00:00
|
|
|
if (Test-Collection "coding") {
|
|
|
|
if ($install) {
|
|
|
|
|
|
|
|
Install-ChocoPackage `
|
|
|
|
gh `
|
|
|
|
github-desktop `
|
|
|
|
ida-free `
|
|
|
|
HxD `
|
|
|
|
docker-desktop `
|
|
|
|
imhex `
|
|
|
|
dotpeek `
|
|
|
|
;
|
|
|
|
|
|
|
|
Remove-DesktopIcon "IDA *";
|
|
|
|
Remove-DesktopIcon "GitHub*";
|
|
|
|
Remove-DesktopIcon "Docker*";
|
|
|
|
}
|
2024-08-08 02:36:35 +00:00
|
|
|
|
2024-08-27 12:05:16 +00:00
|
|
|
& "$softwarePath/vscode/Main.ps1" @arguments;
|
|
|
|
& "$softwarePath/VisualStudio/Manage.ps1" @arguments;
|
2024-08-08 02:36:35 +00:00
|
|
|
|
2024-08-27 12:05:16 +00:00
|
|
|
# Node.js
|
|
|
|
& "$softwarePath/NVS/Manage.ps1" @arguments;
|
|
|
|
}
|
2024-08-08 02:36:35 +00:00
|
|
|
|
2024-08-27 12:05:16 +00:00
|
|
|
if (Test-Collection "gaming") {
|
|
|
|
# Gaming
|
|
|
|
if ($install) {
|
|
|
|
Install-ChocoPackage `
|
|
|
|
goggalaxy `
|
|
|
|
epicgameslauncher `
|
|
|
|
rayman-controlpanel `
|
|
|
|
ppsspp `
|
|
|
|
;
|
|
|
|
|
|
|
|
Remove-DesktopIcon "*Epic Games*";
|
|
|
|
Remove-DesktopIcon "*PPSSPP *-Bit*";
|
|
|
|
|
|
|
|
Install-ChocoPackage `
|
|
|
|
steam `
|
|
|
|
ubisoft-connect `
|
|
|
|
-ArgumentList "--ignore-checksums" `
|
|
|
|
;
|
|
|
|
|
|
|
|
Remove-DesktopIcon "*Steam*";
|
|
|
|
Remove-DesktopIcon "*Ubisoft Connect*";
|
|
|
|
|
|
|
|
Install-WingetPackage ElectronicArts.EADesktop;
|
|
|
|
Remove-DesktopIcon "EA.*";
|
|
|
|
}
|
2024-08-08 02:36:35 +00:00
|
|
|
|
2024-08-27 12:05:16 +00:00
|
|
|
& "$softwarePath/TrackMania Nations Forever/Manage.ps1" @arguments;
|
|
|
|
& "$softwarePath/TrackMania United Forever/Manage.ps1" @arguments;
|
|
|
|
& "$softwarePath/ManiaPlanet/Manage.ps1" @arguments;
|
|
|
|
& "$softwarePath/osu!/Manage.ps1" @arguments;
|
|
|
|
& "$softwarePath/osu!lazer/Manage.ps1" @arguments;
|
|
|
|
& "$softwarePath/RetroArch/Manage.ps1" @arguments;
|
|
|
|
& "$softwarePath/reWASD/Manage.ps1" @arguments;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
}
|
2024-08-08 02:36:35 +00:00
|
|
|
|
2024-08-27 12:05:16 +00:00
|
|
|
switch (Get-Stage) {
|
|
|
|
($null) {
|
|
|
|
Set-Stage ([SetupStage]::Configure);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
([SetupStage]::Configure) {
|
|
|
|
if (Get-Config "valhalla.windows.dualboot.enable") {
|
|
|
|
if (-not (Test-Qemu)) {
|
|
|
|
# Fix synchronization between Linux and Windows clocks.
|
|
|
|
Set-ItemProperty "HKLM:\SYSTEM\CurrentControlSet\Control\TimeZoneInformation" -Name "RealTimeIsUniversal" -Value 1 -Type "DWord";
|
|
|
|
}
|
2024-08-08 02:36:35 +00:00
|
|
|
|
2024-08-27 12:05:16 +00:00
|
|
|
# Force time resynchronization
|
|
|
|
$timeZoneOption = "Start";
|
|
|
|
$timeZoneKey = "HKLM:\SYSTEM\CurrentControlSet\Services\tzautoupdate";
|
|
|
|
$service = Get-Service W32Time;
|
|
|
|
$autoUpdate = (Get-Item $timeZoneKey).GetValue($timeZoneOption);
|
|
|
|
$stopped = ($service.Status -eq "Stopped");
|
|
|
|
|
|
|
|
$setUpdate = { param([int] $Value) Set-ItemProperty $timeZoneKey -Name $timeZoneOption $Value };
|
|
|
|
& $setUpdate 3;
|
|
|
|
Start-Service $service;
|
|
|
|
w32tm /resync /force;
|
|
|
|
& $setUpdate $autoUpdate;
|
|
|
|
|
|
|
|
if ($stopped) {
|
|
|
|
Stop-Service $service;
|
|
|
|
}
|
2024-08-27 02:15:37 +00:00
|
|
|
}
|
2024-08-01 23:44:56 +00:00
|
|
|
|
2024-08-27 12:05:16 +00:00
|
|
|
Set-Stage ([SetupStage]::Install);
|
|
|
|
}
|
|
|
|
([SetupStage]::Install) {
|
|
|
|
Write-Host "Entering install phase";
|
|
|
|
Deploy-SoftwareAction;
|
|
|
|
Set-Stage ([SetupStage]::CreateUser);
|
|
|
|
}
|
|
|
|
([SetupStage]::CreateUser) {
|
|
|
|
$users = @(Get-Users);
|
|
|
|
$i = Get-CurrentUser;
|
2024-08-09 02:19:49 +00:00
|
|
|
|
2024-08-27 12:05:16 +00:00
|
|
|
for (; $i -lt $users.Count; $i++) {
|
|
|
|
$name = $users[$i];
|
|
|
|
$msAccount = Get-UserConfig -UserName $name "microsoftAccount";
|
|
|
|
Set-CurrentUser $i;
|
2024-08-09 02:19:49 +00:00
|
|
|
|
2024-08-27 12:05:16 +00:00
|
|
|
if (Test-Admin) {
|
|
|
|
Disable-BootMessage;
|
2024-08-27 02:15:37 +00:00
|
|
|
}
|
2024-08-09 02:19:49 +00:00
|
|
|
|
2024-08-27 12:05:16 +00:00
|
|
|
while ((Get-UserStage) -ne ([UserStage]::Completed)) {
|
|
|
|
switch (Get-UserStage) {
|
|
|
|
($null) {
|
|
|
|
Set-UserStage ([UserStage]::Create);
|
|
|
|
continue;
|
2024-08-21 01:37:44 +00:00
|
|
|
}
|
2024-08-27 12:05:16 +00:00
|
|
|
([UserStage]::Create) {
|
|
|
|
if ($env:UserName -ne $name) {
|
|
|
|
New-ValhallaUser $name;
|
2024-08-10 13:21:13 +00:00
|
|
|
|
2024-08-27 12:05:16 +00:00
|
|
|
if ($msAccount) {
|
|
|
|
logoff;
|
|
|
|
} else {
|
|
|
|
Restart-Intermediate;
|
2024-08-21 16:34:18 +00:00
|
|
|
}
|
2024-08-27 12:05:16 +00:00
|
|
|
|
|
|
|
exit;
|
|
|
|
} else {
|
|
|
|
if ($msAccount) {
|
|
|
|
if (-not (Test-Admin)) {
|
|
|
|
Invoke-OneShot DisableUAC;
|
|
|
|
Restart-Intermediate -NoRegister;
|
|
|
|
return;
|
2024-08-27 02:15:37 +00:00
|
|
|
}
|
2024-08-27 12:05:16 +00:00
|
|
|
|
|
|
|
Clear-SetupRegistration;
|
|
|
|
Disable-OneShotListener;
|
2024-08-27 02:15:37 +00:00
|
|
|
}
|
2024-08-27 01:27:54 +00:00
|
|
|
|
2024-08-27 12:05:16 +00:00
|
|
|
Set-UserStage ([UserStage]::Configure);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
(([UserStage]::Configure)) {
|
|
|
|
$displayName = Get-UserConfig -UserName $name "displayName";
|
2024-08-27 01:27:54 +00:00
|
|
|
|
2024-08-27 12:05:16 +00:00
|
|
|
$userArguments = @{
|
|
|
|
name = $name;
|
|
|
|
};
|
2024-08-21 16:34:18 +00:00
|
|
|
|
2024-08-27 12:05:16 +00:00
|
|
|
if ($displayName) {
|
|
|
|
$userArguments.fullName = $displayName;
|
|
|
|
}
|
2024-08-21 01:37:44 +00:00
|
|
|
|
2024-08-27 12:05:16 +00:00
|
|
|
$adminGroup = @{
|
|
|
|
SID = [SecurityIdentifier]::new([WellKnownSidType]::BuiltinAdministratorsSid, $null);
|
|
|
|
};
|
2024-08-21 21:21:32 +00:00
|
|
|
|
2024-08-27 12:05:16 +00:00
|
|
|
Set-LocalUser @userArguments;
|
|
|
|
Deploy-SoftwareAction -Action ([InstallerAction]::ConfigureUser);
|
|
|
|
Remove-LocalGroupMember -Member "$name" @adminGroup -ErrorAction SilentlyContinue;
|
2024-08-22 18:41:17 +00:00
|
|
|
|
2024-08-27 12:05:16 +00:00
|
|
|
foreach ($group in Get-UserConfig -UserName "$name" "groups") {
|
|
|
|
Add-LocalGroupMember -Member "$name" -Name "$group";
|
|
|
|
}
|
2024-08-27 02:15:37 +00:00
|
|
|
|
2024-08-27 12:05:16 +00:00
|
|
|
if (-not $msAccount) {
|
|
|
|
net user $name /logonpasswordchg:yes;
|
2024-08-10 13:19:14 +00:00
|
|
|
}
|
2024-08-27 12:05:16 +00:00
|
|
|
|
|
|
|
Set-UserStage ([UserStage]::Cleanup);
|
|
|
|
}
|
|
|
|
([UserStage]::Cleanup) {
|
|
|
|
$user = Get-SetupUser;
|
2024-08-27 12:11:31 +00:00
|
|
|
Disable-LocalUser $name;
|
2024-08-27 12:05:16 +00:00
|
|
|
Enable-LocalUser $user;
|
|
|
|
Set-AutologinUser $user;
|
|
|
|
Unregister-WslDistribution;
|
|
|
|
Set-UserStage ([UserStage]::Completed);
|
|
|
|
Restart-Intermediate;
|
|
|
|
exit;
|
2024-08-09 11:34:46 +00:00
|
|
|
}
|
2024-08-09 02:19:49 +00:00
|
|
|
}
|
|
|
|
}
|
2024-08-01 17:02:12 +00:00
|
|
|
}
|
2024-08-27 12:05:16 +00:00
|
|
|
|
2024-08-27 12:11:31 +00:00
|
|
|
foreach ($user in $users) {
|
|
|
|
Enable-LocalUser $user;
|
|
|
|
}
|
|
|
|
|
2024-08-27 12:05:16 +00:00
|
|
|
Set-IsFinished $true;
|
2024-08-01 14:32:03 +00:00
|
|
|
}
|
2024-07-31 14:09:50 +00:00
|
|
|
}
|
2024-07-31 13:52:41 +00:00
|
|
|
}
|
|
|
|
}
|
2024-03-23 14:09:58 +00:00
|
|
|
|
2024-08-01 17:02:12 +00:00
|
|
|
function Invoke-WindowsInstallation([Context] $context) {
|
|
|
|
$Global:InformationPreference = "Continue";
|
|
|
|
$Global:ErrorActionPreference = "Inquire";
|
|
|
|
$context.UserNames ??= @("Manuel");
|
|
|
|
Start-OldWindowsInstallationScript $context;
|
|
|
|
}
|
2024-03-23 14:09:58 +00:00
|
|
|
|
2024-08-01 17:02:12 +00:00
|
|
|
function Start-OldWindowsInstallationScript([Context] $context) {
|
|
|
|
. "$PSScriptRoot/Upgrade.ps1";
|
|
|
|
$finished = $false;
|
|
|
|
Remove-Item Env:\POSH_THEME -ErrorAction SilentlyContinue;
|
|
|
|
$configPath = "$PSScriptRoot/../Config";
|
|
|
|
$softwarePath = "$PSScriptRoot/../Software";
|
|
|
|
$initialConfigStage = "InitialConfiguration";
|
|
|
|
$prerequisitesStage = "InstallationPrerequisites";
|
|
|
|
$driverStage = "DriverInstallation";
|
|
|
|
$softwareStage = "MachineWideSoftwareInstallation";
|
|
|
|
$userStage = "CreatingUser";
|
|
|
|
$restorationStage = "Restoring";
|
|
|
|
|
|
|
|
|
|
|
|
while (-not $finished) {
|
|
|
|
switch ($context.GetStage()) {
|
|
|
|
{ (-not $_) -or ($_ -eq $initialConfigStage) } {
|
|
|
|
$context.SetStage($initialConfigStage);
|
|
|
|
|
|
|
|
if ((Get-Command Initialize-Configuration -ErrorAction SilentlyContinue)) {
|
|
|
|
Write-Information "Configuration initialization function was found. Running...";
|
|
|
|
Initialize-Configuration $context;
|
|
|
|
}
|
2024-03-23 14:09:58 +00:00
|
|
|
|
2024-08-01 17:02:12 +00:00
|
|
|
$null = Enable-WindowsOptionalFeature -Online -All -FeatureName "NetFx3";
|
|
|
|
|
|
|
|
. "$configPath/Windows/Install.ps1" $context;
|
|
|
|
. "$configPath/Explorer/Install.ps1" $context;
|
|
|
|
. "$configPath/OpenSSH/Install.ps1" $context;
|
|
|
|
. "$configPath/chocolatey/Install.ps1";
|
2024-03-23 14:09:58 +00:00
|
|
|
|
2024-08-01 17:02:12 +00:00
|
|
|
$context.RemoveDesktopIcon("*Microsoft Edge*");
|
|
|
|
$context.SetStage($prerequisitesStage);
|
|
|
|
break;
|
2024-03-23 14:09:58 +00:00
|
|
|
}
|
2024-08-01 17:02:12 +00:00
|
|
|
# Always install updates
|
|
|
|
default {
|
|
|
|
Write-Host "Starting Installation and Restoration of Windows";
|
|
|
|
Update-WindowsInstallation $context;
|
|
|
|
}
|
|
|
|
$prerequisitesStage {
|
|
|
|
Write-Host "Installing prerequisites for installing software";
|
2024-03-23 14:09:58 +00:00
|
|
|
|
2024-08-01 17:02:12 +00:00
|
|
|
if (-not $(Get-Command winget)) {
|
|
|
|
choco install -y winget;
|
|
|
|
}
|
2024-03-23 14:09:58 +00:00
|
|
|
|
2024-08-01 17:02:12 +00:00
|
|
|
Install-Module -AcceptLicense -Force "NuGet";
|
|
|
|
Import-Module NuGet;
|
2024-03-23 14:09:58 +00:00
|
|
|
|
2024-08-01 17:02:12 +00:00
|
|
|
Install-Firefox $context;
|
|
|
|
choco install -y selenium-gecko-driver;
|
|
|
|
$null = Install-Package -Force Selenium.WebDriver -RequiredVersion 4.10.0 -SkipDependencies;
|
2024-03-23 14:09:58 +00:00
|
|
|
|
2024-08-01 17:02:12 +00:00
|
|
|
winget install --accept-source-agreements --accept-package-agreements -e --id AutoHotkey.AutoHotkey;
|
2024-03-23 14:09:58 +00:00
|
|
|
|
2024-08-01 17:02:12 +00:00
|
|
|
$context.SetStage($driverStage);
|
|
|
|
break;
|
2024-03-23 14:09:58 +00:00
|
|
|
}
|
2024-08-01 17:02:12 +00:00
|
|
|
$driverStage {
|
|
|
|
Write-Host "Installing drivers";
|
2024-03-23 14:09:58 +00:00
|
|
|
|
2024-08-01 17:02:12 +00:00
|
|
|
if ((Get-Command Install-PortValhallaDrivers -ErrorAction SilentlyContinue)) {
|
|
|
|
Write-Information "Driver installation function was found. Starting installation";
|
|
|
|
Install-PortValhallaDrivers $context;
|
|
|
|
}
|
|
|
|
|
|
|
|
Write-Information "Finished installing drivers";
|
|
|
|
$context.SetStage($softwareStage);
|
|
|
|
$context.Reboot();
|
|
|
|
exit;
|
|
|
|
}
|
|
|
|
$softwareStage {
|
|
|
|
Write-Host "Setting up software with default app associations";
|
|
|
|
. "$softwarePath/WinSCP/Install.ps1" $context;
|
|
|
|
. "$softwarePath/Thunderbird/Install.ps1" $context;
|
|
|
|
|
|
|
|
Write-Host "Installing default settings for new users";
|
|
|
|
. "$softwarePath/aliae/Install.ps1" $context;
|
|
|
|
. "$softwarePath/posh-git/Install.ps1";
|
|
|
|
. "$softwarePath/Terminal-Icons/Install.ps1";
|
|
|
|
. "$softwarePath/Oh My Posh/Install.ps1" $context;
|
|
|
|
$context.SetStage($userStage);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
$userStage {
|
|
|
|
Install-PersonalUsers $context;
|
|
|
|
$context.SetStage($restorationStage);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
$restorationStage {
|
|
|
|
Restore-WindowsInstallation $context;
|
|
|
|
$finished = $true;
|
|
|
|
break;
|
|
|
|
}
|
2024-03-23 14:09:58 +00:00
|
|
|
}
|
2023-08-13 23:32:57 +00:00
|
|
|
}
|
2023-07-16 10:56:54 +00:00
|
|
|
}
|
2024-08-01 17:02:12 +00:00
|
|
|
};
|