Register WSL before running OneShot tasks
This commit is contained in:
parent
fdeb84f42b
commit
31e3c51f97
1 changed files with 419 additions and 415 deletions
|
@ -170,440 +170,444 @@ $null = New-Module {
|
|||
Set-Stage ([SetupStage]::Configure);
|
||||
break;
|
||||
}
|
||||
([SetupStage]::OneShot) {
|
||||
Write-Host "Running OneShot task ``$(Get-OneShotTask)``";
|
||||
|
||||
Start-OneShot {
|
||||
switch (Get-OneShotTask) {
|
||||
([OneShotTask]::DisableUAC) {
|
||||
Disable-UAC;
|
||||
Register-Setup;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
break;
|
||||
}
|
||||
default {
|
||||
if (-not (& { $null = wsl -l; $? })) {
|
||||
wsl --import-in-place "PortValhalla" "$wslLocation/ext4.vhdx";
|
||||
wsl --set-default "PortValhalla";
|
||||
}
|
||||
|
||||
if (Test-Admin) {
|
||||
$null = Import-Module PSWindowsUpdate;
|
||||
switch ($_) {
|
||||
([SetupStage]::OneShot) {
|
||||
Write-Host "Running OneShot task ``$(Get-OneShotTask)``";
|
||||
|
||||
Invoke-Hook "Invoke-WindowsUpdate" -Fallback {
|
||||
Update-WindowsInstallation;
|
||||
};
|
||||
|
||||
if ((Get-WURebootStatus -Silent)) {
|
||||
Restart-Intermediate;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
<#
|
||||
.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 = $null;
|
||||
$arguments = [hashtable]@{ };
|
||||
|
||||
if ($null -ne $Action) {
|
||||
$install = ($Action -eq ([InstallerAction]::Install));
|
||||
$null = $arguments.Add("action", $Action);
|
||||
} else {
|
||||
$install = $true;
|
||||
}
|
||||
|
||||
# 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;
|
||||
Start-OneShot {
|
||||
switch (Get-OneShotTask) {
|
||||
([OneShotTask]::DisableUAC) {
|
||||
Disable-UAC;
|
||||
Register-Setup;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($install) {
|
||||
if (Get-Config "valhalla.hardware.amdCPU") {
|
||||
Install-ChocoPackage amd-ryzen-master;
|
||||
# ToDo: backup Ryzen energy saving plan
|
||||
}
|
||||
|
||||
if (Get-Config "valhalla.hardware.nvidiaGPU") {
|
||||
Install-ChocoPackage geforce-game-ready-driver;
|
||||
Remove-DesktopIcon "*Geforce*";
|
||||
}
|
||||
|
||||
if (Get-Config "valhalla.hardware.corsairDevice") {
|
||||
Install-ChocoPackage icue;
|
||||
}
|
||||
}
|
||||
|
||||
if (Get-Config "valhalla.hardware.eyeX") {
|
||||
& "$driverPath/Tobii EyeX/Manage.ps1" @arguments;
|
||||
}
|
||||
};
|
||||
|
||||
& {
|
||||
# Windows Config
|
||||
$softwarePath = "$PSScriptRoot/../Software";
|
||||
$commonSoftware = "$PSScriptRoot/../../Common/Software";
|
||||
& "$softwarePath/Windows/Manage.ps1" @arguments;
|
||||
|
||||
if (Get-Config "valhalla.hardware.logitechG") {
|
||||
& "$softwarePath/LGHub/Manage.ps1" @arguments;
|
||||
}
|
||||
|
||||
if (Test-Collection "essential") {
|
||||
# Essentials
|
||||
& "$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 ($install) {
|
||||
Install-ChocoPackage `
|
||||
procexp `
|
||||
procmon `
|
||||
;
|
||||
|
||||
Install-WingetPackage `
|
||||
KDE.KDEConnect `
|
||||
;
|
||||
}
|
||||
}
|
||||
|
||||
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*";
|
||||
}
|
||||
}
|
||||
|
||||
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*";
|
||||
}
|
||||
|
||||
# ToDo: Consider hiding behind own config?
|
||||
& "$softwarePath/Ubiquiti UniFi Controller/Manage.ps1" @arguments;
|
||||
|
||||
# Internet Access
|
||||
& "$softwarePath/Firefox/Manage.ps1" @arguments;
|
||||
& "$softwarePath/MSEdgeRedirect/Manage.ps1" @arguments;
|
||||
|
||||
if (Test-Collection "fileSync") {
|
||||
& "$softwarePath/Nextcloud/Manage.ps1" @arguments;
|
||||
}
|
||||
}
|
||||
|
||||
if (Test-Collection "socialMedia") {
|
||||
if ($install) {
|
||||
Install-ChocoPackage `
|
||||
signal `
|
||||
threema-desktop `
|
||||
element-desktop `
|
||||
teamspeak `
|
||||
;
|
||||
|
||||
Remove-DesktopIcon "*Element*";
|
||||
Remove-DesktopIcon "*TeamSpeak*";
|
||||
|
||||
Install-WingetPackage Discord.Discord;
|
||||
Remove-DesktopIcon "*Discord*";
|
||||
}
|
||||
}
|
||||
|
||||
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*";
|
||||
}
|
||||
}
|
||||
|
||||
if (Test-Collection "coding") {
|
||||
if ($install) {
|
||||
Install-ChocoPackage vscode -ArgumentList "--params","/NoDesktopIcon";
|
||||
Install-ChocoPackage vscodium -ArgumentList "--params","/NoDesktopIcon /AssociateWithFiles";
|
||||
|
||||
Install-ChocoPackage `
|
||||
gh `
|
||||
github-desktop `
|
||||
ida-free `
|
||||
HxD `
|
||||
docker-desktop `
|
||||
imhex `
|
||||
dotpeek `
|
||||
;
|
||||
|
||||
Remove-DesktopIcon "IDA *";
|
||||
Remove-DesktopIcon "GitHub*";
|
||||
Remove-DesktopIcon "Docker*";
|
||||
}
|
||||
|
||||
& "$softwarePath/VisualStudio/Manage.ps1" @arguments;
|
||||
|
||||
# Node.js
|
||||
& "$softwarePath/NVS/Manage.ps1" @arguments;
|
||||
}
|
||||
|
||||
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.*";
|
||||
}
|
||||
|
||||
& "$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;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
switch (Get-Stage) {
|
||||
([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";
|
||||
}
|
||||
|
||||
# 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;
|
||||
}
|
||||
}
|
||||
|
||||
Set-Stage ([SetupStage]::Install);
|
||||
break;
|
||||
}
|
||||
([SetupStage]::Install) {
|
||||
Write-Host "Entering install phase";
|
||||
Deploy-SoftwareAction;
|
||||
Set-Stage ([SetupStage]::CreateUser);
|
||||
}
|
||||
([SetupStage]::CreateUser) {
|
||||
Start-ValhallaUserSetup;
|
||||
Set-Stage ([SetupStage]::ConfigureUser);
|
||||
}
|
||||
([SetupStage]::ConfigureUser) {
|
||||
$userOption = "CurrentUser";
|
||||
|
||||
function Get-CurrentUser {
|
||||
(Get-SetupOption $userOption) ?? 0;
|
||||
}
|
||||
|
||||
function Set-CurrentUser {
|
||||
param([int] $Value)
|
||||
Set-SetupOption $userOption $Value;
|
||||
}
|
||||
|
||||
[string[]] $users = Get-Users;
|
||||
$currentUser = Get-CurrentUser;
|
||||
|
||||
default {
|
||||
if (Test-Admin) {
|
||||
Disable-BootMessage;
|
||||
}
|
||||
$null = Import-Module PSWindowsUpdate;
|
||||
|
||||
if ($currentUser -lt $users.Count) {
|
||||
$user = Get-LocalUser $users[$currentUser];
|
||||
$msAccount = Get-UserConfig -UserName "$user" -Name "microsoftAccount";
|
||||
|
||||
$adminGroup = @{
|
||||
SID = [SecurityIdentifier]::new([WellKnownSidType]::BuiltinAdministratorsSid, $null);
|
||||
Invoke-Hook "Invoke-WindowsUpdate" -Fallback {
|
||||
Update-WindowsInstallation;
|
||||
};
|
||||
|
||||
Add-LocalGroupMember `
|
||||
@adminGroup `
|
||||
$user `
|
||||
-ErrorAction SilentlyContinue;
|
||||
|
||||
if ($env:UserName -ne "$user") {
|
||||
Disable-LocalUser $env:UserName;
|
||||
Enable-LocalUser $user;
|
||||
|
||||
if ($msAccount) {
|
||||
Enable-UAC;
|
||||
Disable-Autologin;
|
||||
Enable-OneShotListener;
|
||||
Set-BootMessage -Caption "Please Log In" -Message "Please log in using your new Microsoft Account ``$user``.";
|
||||
} else {
|
||||
Set-AutologinUser "$user";
|
||||
}
|
||||
|
||||
Restart-Intermediate -DefaultUser;
|
||||
if ((Get-WURebootStatus -Silent)) {
|
||||
Restart-Intermediate;
|
||||
return;
|
||||
} else {
|
||||
$configure = {
|
||||
Deploy-SoftwareAction -Action ([InstallerAction]::ConfigureUser);
|
||||
Remove-LocalGroupMember -Member "$user" @adminGroup -ErrorAction SilentlyContinue;
|
||||
|
||||
foreach ($group in Get-UserConfig -UserName "$user" "groups") {
|
||||
Add-LocalGroupMember -Member "$user" -Name "$group";
|
||||
}
|
||||
}
|
||||
|
||||
if ($msAccount) {
|
||||
if (-not (Test-Admin)) {
|
||||
Invoke-OneShot DisableUAC;
|
||||
Restart-Computer;
|
||||
return;
|
||||
} else {
|
||||
& $configure;
|
||||
Clear-SetupRegistration;
|
||||
Disable-OneShotListener;
|
||||
}
|
||||
} else {
|
||||
& $configure;
|
||||
}
|
||||
}
|
||||
|
||||
if (-not $msAccount) {
|
||||
net user "$user" /logonpasswordchg:yes;
|
||||
}
|
||||
|
||||
Set-CurrentUser ($currentUser + 1);
|
||||
continue;
|
||||
}
|
||||
|
||||
Set-IsFinished $true;
|
||||
<#
|
||||
.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 = $null;
|
||||
$arguments = [hashtable]@{ };
|
||||
|
||||
if ($null -ne $Action) {
|
||||
$install = ($Action -eq ([InstallerAction]::Install));
|
||||
$null = $arguments.Add("action", $Action);
|
||||
} else {
|
||||
$install = $true;
|
||||
}
|
||||
|
||||
# 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($install) {
|
||||
if (Get-Config "valhalla.hardware.amdCPU") {
|
||||
Install-ChocoPackage amd-ryzen-master;
|
||||
# ToDo: backup Ryzen energy saving plan
|
||||
}
|
||||
|
||||
if (Get-Config "valhalla.hardware.nvidiaGPU") {
|
||||
Install-ChocoPackage geforce-game-ready-driver;
|
||||
Remove-DesktopIcon "*Geforce*";
|
||||
}
|
||||
|
||||
if (Get-Config "valhalla.hardware.corsairDevice") {
|
||||
Install-ChocoPackage icue;
|
||||
}
|
||||
}
|
||||
|
||||
if (Get-Config "valhalla.hardware.eyeX") {
|
||||
& "$driverPath/Tobii EyeX/Manage.ps1" @arguments;
|
||||
}
|
||||
};
|
||||
|
||||
& {
|
||||
# Windows Config
|
||||
$softwarePath = "$PSScriptRoot/../Software";
|
||||
$commonSoftware = "$PSScriptRoot/../../Common/Software";
|
||||
& "$softwarePath/Windows/Manage.ps1" @arguments;
|
||||
|
||||
if (Get-Config "valhalla.hardware.logitechG") {
|
||||
& "$softwarePath/LGHub/Manage.ps1" @arguments;
|
||||
}
|
||||
|
||||
if (Test-Collection "essential") {
|
||||
# Essentials
|
||||
& "$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 ($install) {
|
||||
Install-ChocoPackage `
|
||||
procexp `
|
||||
procmon `
|
||||
;
|
||||
|
||||
Install-WingetPackage `
|
||||
KDE.KDEConnect `
|
||||
;
|
||||
}
|
||||
}
|
||||
|
||||
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*";
|
||||
}
|
||||
}
|
||||
|
||||
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*";
|
||||
}
|
||||
|
||||
# ToDo: Consider hiding behind own config?
|
||||
& "$softwarePath/Ubiquiti UniFi Controller/Manage.ps1" @arguments;
|
||||
|
||||
# Internet Access
|
||||
& "$softwarePath/Firefox/Manage.ps1" @arguments;
|
||||
& "$softwarePath/MSEdgeRedirect/Manage.ps1" @arguments;
|
||||
|
||||
if (Test-Collection "fileSync") {
|
||||
& "$softwarePath/Nextcloud/Manage.ps1" @arguments;
|
||||
}
|
||||
}
|
||||
|
||||
if (Test-Collection "socialMedia") {
|
||||
if ($install) {
|
||||
Install-ChocoPackage `
|
||||
signal `
|
||||
threema-desktop `
|
||||
element-desktop `
|
||||
teamspeak `
|
||||
;
|
||||
|
||||
Remove-DesktopIcon "*Element*";
|
||||
Remove-DesktopIcon "*TeamSpeak*";
|
||||
|
||||
Install-WingetPackage Discord.Discord;
|
||||
Remove-DesktopIcon "*Discord*";
|
||||
}
|
||||
}
|
||||
|
||||
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*";
|
||||
}
|
||||
}
|
||||
|
||||
if (Test-Collection "coding") {
|
||||
if ($install) {
|
||||
Install-ChocoPackage vscode -ArgumentList "--params","/NoDesktopIcon";
|
||||
Install-ChocoPackage vscodium -ArgumentList "--params","/NoDesktopIcon /AssociateWithFiles";
|
||||
|
||||
Install-ChocoPackage `
|
||||
gh `
|
||||
github-desktop `
|
||||
ida-free `
|
||||
HxD `
|
||||
docker-desktop `
|
||||
imhex `
|
||||
dotpeek `
|
||||
;
|
||||
|
||||
Remove-DesktopIcon "IDA *";
|
||||
Remove-DesktopIcon "GitHub*";
|
||||
Remove-DesktopIcon "Docker*";
|
||||
}
|
||||
|
||||
& "$softwarePath/VisualStudio/Manage.ps1" @arguments;
|
||||
|
||||
# Node.js
|
||||
& "$softwarePath/NVS/Manage.ps1" @arguments;
|
||||
}
|
||||
|
||||
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.*";
|
||||
}
|
||||
|
||||
& "$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;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
switch ($_) {
|
||||
([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";
|
||||
}
|
||||
|
||||
# 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;
|
||||
}
|
||||
}
|
||||
|
||||
Set-Stage ([SetupStage]::Install);
|
||||
}
|
||||
([SetupStage]::Install) {
|
||||
Write-Host "Entering install phase";
|
||||
Deploy-SoftwareAction;
|
||||
Set-Stage ([SetupStage]::CreateUser);
|
||||
}
|
||||
([SetupStage]::CreateUser) {
|
||||
Start-ValhallaUserSetup;
|
||||
Set-Stage ([SetupStage]::ConfigureUser);
|
||||
}
|
||||
([SetupStage]::ConfigureUser) {
|
||||
$userOption = "CurrentUser";
|
||||
|
||||
function Get-CurrentUser {
|
||||
(Get-SetupOption $userOption) ?? 0;
|
||||
}
|
||||
|
||||
function Set-CurrentUser {
|
||||
param([int] $Value)
|
||||
Set-SetupOption $userOption $Value;
|
||||
}
|
||||
|
||||
[string[]] $users = Get-Users;
|
||||
$currentUser = Get-CurrentUser;
|
||||
|
||||
if (Test-Admin) {
|
||||
Disable-BootMessage;
|
||||
}
|
||||
|
||||
if ($currentUser -lt $users.Count) {
|
||||
$user = Get-LocalUser $users[$currentUser];
|
||||
$msAccount = Get-UserConfig -UserName "$user" -Name "microsoftAccount";
|
||||
|
||||
$adminGroup = @{
|
||||
SID = [SecurityIdentifier]::new([WellKnownSidType]::BuiltinAdministratorsSid, $null);
|
||||
};
|
||||
|
||||
Add-LocalGroupMember `
|
||||
@adminGroup `
|
||||
$user `
|
||||
-ErrorAction SilentlyContinue;
|
||||
|
||||
if ($env:UserName -ne "$user") {
|
||||
Disable-LocalUser $env:UserName;
|
||||
Enable-LocalUser $user;
|
||||
|
||||
if ($msAccount) {
|
||||
Enable-UAC;
|
||||
Disable-Autologin;
|
||||
Enable-OneShotListener;
|
||||
Set-BootMessage -Caption "Please Log In" -Message "Please log in using your new Microsoft Account ``$user``.";
|
||||
} else {
|
||||
Set-AutologinUser "$user";
|
||||
}
|
||||
|
||||
Restart-Intermediate -DefaultUser;
|
||||
return;
|
||||
} else {
|
||||
$configure = {
|
||||
Deploy-SoftwareAction -Action ([InstallerAction]::ConfigureUser);
|
||||
Remove-LocalGroupMember -Member "$user" @adminGroup -ErrorAction SilentlyContinue;
|
||||
|
||||
foreach ($group in Get-UserConfig -UserName "$user" "groups") {
|
||||
Add-LocalGroupMember -Member "$user" -Name "$group";
|
||||
}
|
||||
}
|
||||
|
||||
if ($msAccount) {
|
||||
if (-not (Test-Admin)) {
|
||||
Invoke-OneShot DisableUAC;
|
||||
Restart-Computer;
|
||||
return;
|
||||
} else {
|
||||
& $configure;
|
||||
Clear-SetupRegistration;
|
||||
Disable-OneShotListener;
|
||||
}
|
||||
} else {
|
||||
& $configure;
|
||||
}
|
||||
}
|
||||
|
||||
if (-not $msAccount) {
|
||||
net user "$user" /logonpasswordchg:yes;
|
||||
}
|
||||
|
||||
Set-CurrentUser ($currentUser + 1);
|
||||
continue;
|
||||
}
|
||||
|
||||
Set-IsFinished $true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue