Compare commits
29 commits
39abd90b34
...
eae1d94b26
Author | SHA1 | Date | |
---|---|---|---|
Manuel Thalmann | eae1d94b26 | ||
Manuel Thalmann | 451b7a21e6 | ||
Manuel Thalmann | a41016ea86 | ||
Manuel Thalmann | 3388ddc84e | ||
Manuel Thalmann | 8e155a00d5 | ||
Manuel Thalmann | cac1df3027 | ||
Manuel Thalmann | 3b79053455 | ||
Manuel Thalmann | 16a8f8d499 | ||
Manuel Thalmann | 44d8223cd5 | ||
Manuel Thalmann | 797fde65af | ||
Manuel Thalmann | fc95d4c76d | ||
Manuel Thalmann | c5ccae9b35 | ||
Manuel Thalmann | 8efc752218 | ||
Manuel Thalmann | 79098f5efb | ||
Manuel Thalmann | 86374baf2f | ||
Manuel Thalmann | 5ad857320d | ||
Manuel Thalmann | 05ad26763a | ||
Manuel Thalmann | c08afd1221 | ||
Manuel Thalmann | bc4055d760 | ||
Manuel Thalmann | 65c2d8e714 | ||
Manuel Thalmann | 5b084342c5 | ||
Manuel Thalmann | 245af3c2a0 | ||
Manuel Thalmann | aeeedd02ee | ||
Manuel Thalmann | bb3de634f9 | ||
Manuel Thalmann | b16094f8f7 | ||
Manuel Thalmann | 9e37f99036 | ||
Manuel Thalmann | 116d6d9676 | ||
Manuel Thalmann | 3d67480a80 | ||
Manuel Thalmann | c79bec479d |
|
@ -32,6 +32,7 @@
|
||||||
hardware = {
|
hardware = {
|
||||||
components = [
|
components = [
|
||||||
"ROG Zenith Extreme Alpha"
|
"ROG Zenith Extreme Alpha"
|
||||||
|
"Predator Z301C"
|
||||||
];
|
];
|
||||||
|
|
||||||
eyeX = true;
|
eyeX = true;
|
||||||
|
|
|
@ -7,6 +7,7 @@ enum SetupStage {
|
||||||
Configure
|
Configure
|
||||||
Install
|
Install
|
||||||
CreateUser
|
CreateUser
|
||||||
|
ConfigureUser
|
||||||
}
|
}
|
||||||
|
|
||||||
$null = New-Module {
|
$null = New-Module {
|
||||||
|
@ -149,9 +150,21 @@ $null = New-Module {
|
||||||
Gets the names of the users to create.
|
Gets the names of the users to create.
|
||||||
#>
|
#>
|
||||||
function Get-Users {
|
function Get-Users {
|
||||||
|
[OutputType([string[]])]
|
||||||
|
param()
|
||||||
Get-Attributes "valhalla.windows.users";
|
Get-Attributes "valhalla.windows.users";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
<#
|
||||||
|
.SYNOPSIS
|
||||||
|
Gets the name of the setup user.
|
||||||
|
#>
|
||||||
|
function Get-SetupUser {
|
||||||
|
[OutputType([string])]
|
||||||
|
param()
|
||||||
|
Get-Config "valhalla.windows.setupUser";
|
||||||
|
}
|
||||||
|
|
||||||
<#
|
<#
|
||||||
.SYNOPSIS
|
.SYNOPSIS
|
||||||
Gets the value of an option related to the setup.
|
Gets the value of an option related to the setup.
|
||||||
|
|
|
@ -10,5 +10,6 @@ function Start-Operation {
|
||||||
$env:CONFIG_MODULE = Resolve-Path $env:CONFIG_MODULE;
|
$env:CONFIG_MODULE = Resolve-Path $env:CONFIG_MODULE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
New-Alias "sudo" gsudo;
|
||||||
& $Action;
|
& $Action;
|
||||||
}
|
}
|
||||||
|
|
|
@ -72,7 +72,8 @@ $null = New-Module {
|
||||||
winget install `
|
winget install `
|
||||||
--accept-source-agreements --accept-package-agreements `
|
--accept-source-agreements --accept-package-agreements `
|
||||||
--source winget `
|
--source winget `
|
||||||
--exact --id $name $ArgumentList;
|
$ArgumentList `
|
||||||
|
--exact --id $name ;
|
||||||
} else {
|
} else {
|
||||||
Write-Host "Package ``$name`` is already installed"
|
Write-Host "Package ``$name`` is already installed"
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,9 @@
|
||||||
#!/bin/pwsh
|
#!/bin/pwsh
|
||||||
|
using namespace System.Security.Principal;
|
||||||
|
|
||||||
. "$PSScriptRoot/../../../scripts/Windows/Scripts/Prerequisites.ps1";
|
. "$PSScriptRoot/../../../scripts/Windows/Scripts/Prerequisites.ps1";
|
||||||
. "$PSScriptRoot/../../Common/Scripts/Context.ps1";
|
. "$PSScriptRoot/../../Common/Scripts/Context.ps1";
|
||||||
|
. "$PSScriptRoot/../Scripts/Security.ps1";
|
||||||
. "$PSScriptRoot/../Software/Firefox/Install.ps1";
|
. "$PSScriptRoot/../Software/Firefox/Install.ps1";
|
||||||
. "$PSScriptRoot/Manage.ps1";
|
. "$PSScriptRoot/Manage.ps1";
|
||||||
. "$PSScriptRoot/User/Install.ps1";
|
. "$PSScriptRoot/User/Install.ps1";
|
||||||
|
@ -8,6 +11,7 @@
|
||||||
$null = New-Module {
|
$null = New-Module {
|
||||||
. "$PSScriptRoot/../Scripts/Hooks.ps1";
|
. "$PSScriptRoot/../Scripts/Hooks.ps1";
|
||||||
. "$PSScriptRoot/../Scripts/PowerManagement.ps1";
|
. "$PSScriptRoot/../Scripts/PowerManagement.ps1";
|
||||||
|
. "$PSScriptRoot/../Scripts/Registry.ps1";
|
||||||
. "$PSScriptRoot/../Scripts/Update.ps1";
|
. "$PSScriptRoot/../Scripts/Update.ps1";
|
||||||
. "$PSScriptRoot/../Scripts/Users.ps1";
|
. "$PSScriptRoot/../Scripts/Users.ps1";
|
||||||
. "$PSScriptRoot/../../Common/Scripts/Config.ps1";
|
. "$PSScriptRoot/../../Common/Scripts/Config.ps1";
|
||||||
|
@ -32,394 +36,449 @@ $null = New-Module {
|
||||||
#>
|
#>
|
||||||
function Start-InstallationLoop {
|
function Start-InstallationLoop {
|
||||||
while (-not (Get-IsFinished)) {
|
while (-not (Get-IsFinished)) {
|
||||||
if ($null -eq (Get-Stage)) {
|
switch (Get-Stage) {
|
||||||
Set-Stage ([SetupStage]::Initialize);
|
($null) {
|
||||||
} elseif ((Get-Stage) -eq ([SetupStage]::Initialize)) {
|
Set-Stage ([SetupStage]::Initialize);
|
||||||
if (-not ((Test-Command "choco") -and (Test-Command "refreshenv"))) {
|
break;
|
||||||
Invoke-Hook "Install-Chocolatey" -Fallback {
|
|
||||||
# Install chocolatey
|
|
||||||
[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072;
|
|
||||||
Invoke-Expression ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'));
|
|
||||||
Import-Module $env:ChocolateyInstall/helpers/chocolateyProfile.psm1;
|
|
||||||
refreshenv;
|
|
||||||
};
|
|
||||||
|
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
|
([SetupStage]::Initialize) {
|
||||||
|
if (-not ((Test-Command "choco") -and (Test-Command "refreshenv"))) {
|
||||||
|
Invoke-Hook "Install-Chocolatey" -Fallback {
|
||||||
|
# Install chocolatey
|
||||||
|
[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072;
|
||||||
|
Invoke-Expression ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'));
|
||||||
|
Import-Module $env:ChocolateyInstall/helpers/chocolateyProfile.psm1;
|
||||||
|
refreshenv;
|
||||||
|
};
|
||||||
|
|
||||||
if (-not (Test-Command "git")) {
|
continue;
|
||||||
Install-ChocoPackage git;
|
|
||||||
refreshenv;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (-not (Test-ChocoPackage "powershell-core")) {
|
|
||||||
Invoke-Hook "Install-PowerShellCore" -Fallback {
|
|
||||||
choco install -y powershell-core --install-arguments='"ADD_FILE_CONTEXT_MENU_RUNPOWERSHELL=1 ADD_EXPLORER_CONTEXT_MENU_OPENPOWERSHELL=1 REGISTER_MANIFEST=1 USER_MU=1 ENABLE_MU=1"';
|
|
||||||
};
|
|
||||||
|
|
||||||
Restart-Intermediate;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Test-Path $env:PWSH_PATH) {
|
|
||||||
attrib "-R" "$env:PWSH_PATH\*" /S /D;
|
|
||||||
Remove-Item -Recurse -Force $env:PWSH_PATH;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (-not (Test-Winget)) {
|
|
||||||
. "$PSScriptRoot/../Software/winget/Manage.ps1";
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (-not (& { $null = wsl --status; $?; })) {
|
|
||||||
wsl --install --no-launch;
|
|
||||||
Restart-Intermediate;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (-not (& { $null = wsl -l; $?; })) {
|
|
||||||
ubuntu install --root;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (-not (wsl --shell-type login type -t nix)) {
|
|
||||||
wsl -- sh `<`(curl -L https://nixos.org/nix/install`) --daemon --yes;
|
|
||||||
wsl --shutdown;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (-not (Test-PSPackage Selenium.WebDriver)) {
|
|
||||||
Write-Host "Installing browser automation tools…";
|
|
||||||
Install-Module -AcceptLicense -Force NuGet;
|
|
||||||
Import-Module NuGet;
|
|
||||||
$null = Install-Package -Force Selenium.WebDriver -RequiredVersion 4.10.0 -SkipDependencies;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
Install-ChocoPackage selenium-gecko-driver firefox;
|
|
||||||
|
|
||||||
Invoke-Hook "Install-PSModules" -Fallback {
|
|
||||||
Install-Module -AcceptLicense -Force PSWindowsUpdate;
|
|
||||||
Install-Module -AcceptLicense -Force PSScriptAnalyzer;
|
|
||||||
. "$PSScriptRoot/../Software/PinnedItem/Manage.ps1";
|
|
||||||
};
|
|
||||||
|
|
||||||
Set-Stage ([SetupStage]::Configure);
|
|
||||||
} else {
|
|
||||||
$null = Import-Module PSWindowsUpdate;
|
|
||||||
|
|
||||||
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(
|
|
||||||
[InstallerAction] $Action
|
|
||||||
)
|
|
||||||
|
|
||||||
[bool] $install = $null;
|
|
||||||
$arguments = [hashtable]@{ };
|
|
||||||
|
|
||||||
if ($Action) {
|
|
||||||
$install = $true;
|
|
||||||
$null = $arguments.Add("action", $Action);
|
|
||||||
} else {
|
|
||||||
$install = ($Action -eq ([InstallerAction]::Install));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Drivers
|
if (-not (Test-Command "gsudo")) {
|
||||||
$null = New-Module {
|
Install-ChocoPackage gsudo;
|
||||||
$driverPath = "$PSScriptRoot/../Drivers";
|
refreshenv;
|
||||||
$mbPath = "$driverPath/ROG Zenith Extreme Alpha";
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
foreach ($component in (Get-Config "valhalla.hardware.components")) {
|
if (-not (Test-Command "git")) {
|
||||||
|
Install-ChocoPackage git;
|
||||||
|
refreshenv;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
switch ($component) {
|
if (-not (Test-ChocoPackage "powershell-core")) {
|
||||||
("ROG Zenith Extreme Alpha") {
|
Invoke-Hook "Install-PowerShellCore" -Fallback {
|
||||||
. "$mbPath/MarvellEthernet/Manage.ps1" @arguments;
|
choco install -y powershell-core --install-arguments='"ADD_FILE_CONTEXT_MENU_RUNPOWERSHELL=1 ADD_EXPLORER_CONTEXT_MENU_OPENPOWERSHELL=1 REGISTER_MANIFEST=1 USER_MU=1 ENABLE_MU=1"';
|
||||||
. "$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) {
|
Restart-Intermediate;
|
||||||
if (Get-Config "valhalla.hardware.amdCPU") {
|
return;
|
||||||
Install-ChocoPackage amd-ryzen-master;
|
}
|
||||||
# ToDo: backup Ryzen energy saving plan
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Get-Config "valhalla.hardware.nvidiaGPU") {
|
if ($env:PWSH_PATH -and (Test-Path $env:PWSH_PATH)) {
|
||||||
Install-ChocoPackage geforce-game-ready-driver;
|
attrib "-R" "$env:PWSH_PATH\*" /S /D;
|
||||||
Remove-DesktopIcon "*Geforce*";
|
Remove-Item -Recurse -Force $env:PWSH_PATH;
|
||||||
}
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (Get-Config "valhalla.hardware.corsairLighting") {
|
if (-not (Test-Winget)) {
|
||||||
Install-ChocoPackage icue;
|
. "$PSScriptRoot/../Software/winget/Manage.ps1";
|
||||||
}
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (Get-Config "valhalla.hardware.elgatoWave") {
|
if (-not (& { $null = wsl --status; $?; })) {
|
||||||
if (-not (Test-ChocoPackage wavelink)) {
|
wsl --install --no-launch;
|
||||||
Install-ChocoPackage wavelink -ArgumentList '--install-arguments="/norestart"';
|
Restart-Intermediate;
|
||||||
Remove-DesktopIcon "*Wave Link*";
|
return;
|
||||||
Restart-Intermediate;
|
}
|
||||||
exit;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Get-Config "valhalla.hardware.eyeX") {
|
if (-not (& { $null = wsl -l; $?; })) {
|
||||||
. "$driverPath/Tobii EyeX/Manage.ps1" @arguments;
|
ubuntu install --root;
|
||||||
}
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (-not (wsl --shell-type login type -t nix)) {
|
||||||
|
wsl -- sh `<`(curl -L https://nixos.org/nix/install`) --daemon --yes;
|
||||||
|
wsl --shutdown;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (-not (Test-PSPackage Selenium.WebDriver)) {
|
||||||
|
Write-Host "Installing browser automation tools…";
|
||||||
|
Install-Module -AcceptLicense -Force NuGet;
|
||||||
|
Import-Module NuGet;
|
||||||
|
$null = Install-Package -Force Selenium.WebDriver -RequiredVersion 4.10.0 -SkipDependencies;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
Install-ChocoPackage selenium-gecko-driver firefox;
|
||||||
|
|
||||||
|
Invoke-Hook "Install-PSModules" -Fallback {
|
||||||
|
Install-Module -AcceptLicense -Force PSWindowsUpdate;
|
||||||
|
Install-Module -AcceptLicense -Force PSScriptAnalyzer;
|
||||||
|
. "$PSScriptRoot/../Software/PinnedItem/Manage.ps1";
|
||||||
};
|
};
|
||||||
|
|
||||||
$null = New-Module {
|
Set-Stage ([SetupStage]::Configure);
|
||||||
# Windows Config
|
break;
|
||||||
$softwarePath = "$PSScriptRoot/../Software";
|
}
|
||||||
$commonSoftware = "$PSScriptRoot/../../Common/Software";
|
default {
|
||||||
. "$softwarePath/Windows/Manage.ps1" @arguments;
|
$null = Import-Module PSWindowsUpdate;
|
||||||
|
|
||||||
if (Get-Config "valhalla.hardware.logitechG") {
|
Invoke-Hook "Invoke-WindowsUpdate" -Fallback {
|
||||||
. "$softwarePath/LGHub/Manage.ps1" @arguments;
|
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(
|
||||||
|
[InstallerAction] $Action
|
||||||
|
)
|
||||||
|
|
||||||
|
[bool] $install = $null;
|
||||||
|
$arguments = [hashtable]@{ };
|
||||||
|
|
||||||
|
if ($Action) {
|
||||||
|
$install = ($Action -eq ([InstallerAction]::Install));
|
||||||
|
$null = $arguments.Add("action", $Action);
|
||||||
|
} else {
|
||||||
|
$install = $true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Test-Collection "essential") {
|
# Drivers
|
||||||
# Essentials
|
$null = New-Module {
|
||||||
. "$softwarePath/OpenSSH/Manage.ps1" @arguments;
|
$driverPath = "$PSScriptRoot/../Drivers";
|
||||||
. "$softwarePath/PowerShell/Manage.ps1" @arguments;
|
$mbPath = "$driverPath/ROG Zenith Extreme Alpha";
|
||||||
. "$softwarePath/chocolatey/Manage.ps1" @arguments;
|
|
||||||
. "$softwarePath/zoxide/Manage.ps1" @arguments;
|
|
||||||
. "$commonSoftware/posh-git/Manage.ps1" @arguments;
|
|
||||||
. "$commonSoftware/Terminal-Icons/Manage.ps1" @arguments;
|
|
||||||
. "$commonSoftware/Oh My Posh/Manage.ps1" @arguments;
|
|
||||||
|
|
||||||
if ($install) {
|
foreach ($component in (Get-Config "valhalla.hardware.components")) {
|
||||||
Install-ChocoPackage `
|
|
||||||
procexp `
|
|
||||||
procmon `
|
|
||||||
;
|
|
||||||
|
|
||||||
Install-WingetPackage `
|
switch ($component) {
|
||||||
KDE.KDEConnect `
|
("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 (Test-Collection "common") {
|
|
||||||
# Common Software
|
|
||||||
. "$softwarePath/WinSCP/Manage.ps1" @arguments;
|
|
||||||
. "$softwarePath/Thunderbird/Manage.ps1" @arguments;
|
|
||||||
. "$softwarePath/PuTTY/Manage.ps1" @arguments;
|
|
||||||
|
|
||||||
if ($install) {
|
if ($install) {
|
||||||
Install-ChocoPackage `
|
if (Get-Config "valhalla.hardware.amdCPU") {
|
||||||
7zip `
|
Install-ChocoPackage amd-ryzen-master;
|
||||||
chocolateygui `
|
# ToDo: backup Ryzen energy saving plan
|
||||||
DefaultProgramsEditor `
|
}
|
||||||
bitwarden `
|
|
||||||
keepass `
|
|
||||||
;
|
|
||||||
|
|
||||||
Install-WingetPackage `
|
if (Get-Config "valhalla.hardware.nvidiaGPU") {
|
||||||
SomePythonThings.WingetUIStore `
|
Install-ChocoPackage geforce-game-ready-driver;
|
||||||
;
|
Remove-DesktopIcon "*Geforce*";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Get-Config "valhalla.hardware.corsairDevice") {
|
||||||
|
Install-ChocoPackage icue;
|
||||||
|
}
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (Test-Collection "desktopExperience") {
|
if (Get-Config "valhalla.hardware.eyeX") {
|
||||||
if ($install) {
|
. "$driverPath/Tobii EyeX/Manage.ps1" @arguments;
|
||||||
# Fonts
|
}
|
||||||
Install-ChocoPackage nerd-fonts-CascadiaCode;
|
};
|
||||||
|
|
||||||
|
$null = New-Module {
|
||||||
|
# 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;
|
||||||
|
. "$commonSoftware/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 `
|
||||||
|
;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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";
|
||||||
|
|
||||||
|
Install-ChocoPackage `
|
||||||
|
gimp `
|
||||||
|
gpu-z `
|
||||||
|
windirstat `
|
||||||
|
winmerge `
|
||||||
|
handbrake `
|
||||||
|
hwmonitor `
|
||||||
|
qbittorrent `
|
||||||
|
imgburn `
|
||||||
|
inkscape `
|
||||||
|
krita `
|
||||||
|
MetaX `
|
||||||
|
obs-studio
|
||||||
|
;
|
||||||
|
|
||||||
|
Remove-DesktopIcon "GPU-Z*";
|
||||||
|
Remove-DesktopIcon "WinDirStat*";
|
||||||
|
Remove-DesktopIcon "*HWMonitor*";
|
||||||
|
Remove-DesktopIcon "ImgBurn*";
|
||||||
|
Remove-DesktopIcon "InkScape*";
|
||||||
|
Remove-DesktopIcon "Krita*";
|
||||||
|
Remove-DesktopIcon "mRemoteNG*";
|
||||||
|
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
|
# Internet Access
|
||||||
Install-WingetPackage Brave.Brave kamranahmedse.pennywise;
|
. "$softwarePath/Firefox/Manage.ps1" @arguments;
|
||||||
Remove-DesktopIcon "*Brave*";
|
. "$softwarePath/MSEdgeRedirect/Manage.ps1" @arguments;
|
||||||
Remove-TaskbarItem "*Brave*";
|
|
||||||
Remove-DesktopIcon "Pennywise*";
|
|
||||||
|
|
||||||
# Tools
|
if (Test-Collection "fileSync") {
|
||||||
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";
|
. "$softwarePath/Nextcloud/Manage.ps1" @arguments;
|
||||||
|
}
|
||||||
Install-ChocoPackage `
|
|
||||||
gimp `
|
|
||||||
gpu-z `
|
|
||||||
windirstat `
|
|
||||||
winmerge `
|
|
||||||
handbrake `
|
|
||||||
hwmonitor `
|
|
||||||
qbittorrent `
|
|
||||||
imgburn `
|
|
||||||
inkscape `
|
|
||||||
krita `
|
|
||||||
MetaX `
|
|
||||||
obs-studio
|
|
||||||
;
|
|
||||||
|
|
||||||
Remove-DesktopIcon "GPU-Z*";
|
|
||||||
Remove-DesktopIcon "WinDirStat*";
|
|
||||||
Remove-DesktopIcon "*HWMonitor*";
|
|
||||||
Remove-DesktopIcon "ImgBurn*";
|
|
||||||
Remove-DesktopIcon "InkScape*";
|
|
||||||
Remove-DesktopIcon "Krita*";
|
|
||||||
Remove-DesktopIcon "mRemoteNG*";
|
|
||||||
Remove-DesktopIcon "MetaX*";
|
|
||||||
Remove-DesktopIcon "OBS Studio*";
|
|
||||||
|
|
||||||
Install-WingetPackage `
|
|
||||||
AntSoftware.AntRenamer `
|
|
||||||
AppWork.JDownloader;
|
|
||||||
|
|
||||||
Remove-DesktopIcon "JDownloader*";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# ToDo: Consider hiding behind own config?
|
if (Test-Collection "socialMedia") {
|
||||||
. "$softwarePath/Ubiquiti UniFi Controller/Manage.ps1" @arguments;
|
if ($install) {
|
||||||
|
Install-ChocoPackage `
|
||||||
|
signal `
|
||||||
|
threema-desktop `
|
||||||
|
element-desktop `
|
||||||
|
teamspeak `
|
||||||
|
;
|
||||||
|
|
||||||
# Internet Access
|
Remove-DesktopIcon "*Element*";
|
||||||
. "$softwarePath/Firefox/Manage.ps1" @arguments;
|
Remove-DesktopIcon "*TeamSpeak*";
|
||||||
. "$softwarePath/MSEdgeRedirect/Manage.ps1" @arguments;
|
|
||||||
|
|
||||||
if (Test-Collection "fileSync") {
|
Install-WingetPackage Discord.Discord;
|
||||||
. "$softwarePath/Nextcloud/Manage.ps1" @arguments;
|
Remove-DesktopIcon "*Discord*";
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
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 `
|
|
||||||
jellyfin-media-player `
|
|
||||||
vlc `
|
|
||||||
;
|
|
||||||
|
|
||||||
Remove-DesktopIcon "VLC*";
|
|
||||||
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;
|
if (Test-Collection "media") {
|
||||||
|
if ($install) {
|
||||||
|
Install-ChocoPackage `
|
||||||
|
k-litecodecpackmega `
|
||||||
|
jellyfin-media-player `
|
||||||
|
vlc `
|
||||||
|
;
|
||||||
|
|
||||||
# Node.js
|
Remove-DesktopIcon "VLC*";
|
||||||
. "$softwarePath/NVS/Manage.ps1" @arguments;
|
Install-WingetPackage Ytmdesktop.Ytmdesktop;
|
||||||
}
|
Remove-DesktopIcon "Youtube Music*";
|
||||||
|
}
|
||||||
if (Test-Collection "gaming") {
|
|
||||||
# Gaming
|
|
||||||
if ($install) {
|
|
||||||
Install-ChocoPackage `
|
|
||||||
goggalaxy `
|
|
||||||
epicgameslauncher `
|
|
||||||
steam `
|
|
||||||
rayman-controlpanel `
|
|
||||||
ppsspp `
|
|
||||||
;
|
|
||||||
|
|
||||||
Remove-DesktopIcon "*Epic Games*";
|
|
||||||
Remove-DesktopIcon "*Steam*";
|
|
||||||
Remove-DesktopIcon "*PPSSPP *-Bit*";
|
|
||||||
|
|
||||||
Install-ChocoPackage ubisoft-connect -ArgumentList "--ignore-checksums";
|
|
||||||
Remove-DesktopIcon "*Ubisoft Connect*";
|
|
||||||
|
|
||||||
Install-WingetPackage ElectronicArts.EADesktop;
|
|
||||||
Remove-DesktopIcon "EA.*";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
. "$softwarePath/TrackMania Nations Forever/Manage.ps1" @arguments;
|
if (Test-Collection "coding") {
|
||||||
. "$softwarePath/TrackMania United Forever/Manage.ps1" @arguments;
|
if ($install) {
|
||||||
. "$softwarePath/ManiaPlanet/Manage.ps1" @arguments;
|
Install-ChocoPackage vscode -ArgumentList "--params","/NoDesktopIcon";
|
||||||
. "$softwarePath/osu!/Manage.ps1" @arguments;
|
Install-ChocoPackage vscodium -ArgumentList "--params","/NoDesktopIcon /AssociateWithFiles";
|
||||||
. "$softwarePath/osu!lazer/Manage.ps1" @arguments;
|
|
||||||
. "$softwarePath/RetorArch/Manage.ps1" @arguments;
|
|
||||||
. "$softwarePath/reWASD/Manage.ps1" @arguments;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (Get-Stage) {
|
Install-ChocoPackage `
|
||||||
([SetupStage]::Configure) {
|
gh `
|
||||||
if (Get-Config "valhalla.windows.dualboot.enable") {
|
github-desktop `
|
||||||
# Fix synchronization between Linux and Windows clocks.
|
ida-free `
|
||||||
Set-ItemProperty "HKLM:\SYSTEM\CurrentControlSet\Control\TimeZoneInformation" -Name "RealTimeIsUniversal" -Value 1 -Type "DWord";
|
HxD `
|
||||||
|
docker-desktop `
|
||||||
|
imhex `
|
||||||
|
dotpeek `
|
||||||
|
;
|
||||||
|
|
||||||
# Force time resynchronization
|
Remove-DesktopIcon "IDA *";
|
||||||
$service = Get-Service W32Time;
|
Remove-DesktopIcon "GitHub*";
|
||||||
$stopped = ($service.Status -eq "Stopped");
|
Remove-DesktopIcon "Docker*";
|
||||||
Start-Service $service;
|
}
|
||||||
w32tm /resync /force;
|
|
||||||
|
|
||||||
if ($stopped) {
|
. "$softwarePath/VisualStudio/Manage.ps1" @arguments;
|
||||||
Stop-Service $service;
|
|
||||||
|
# Node.js
|
||||||
|
. "$softwarePath/NVS/Manage.ps1" @arguments;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
Set-Stage ([SetupStage]::Install);
|
if (Test-Collection "gaming") {
|
||||||
|
# Gaming
|
||||||
|
if ($install) {
|
||||||
|
Install-ChocoPackage `
|
||||||
|
goggalaxy `
|
||||||
|
epicgameslauncher `
|
||||||
|
steam `
|
||||||
|
rayman-controlpanel `
|
||||||
|
ppsspp `
|
||||||
|
;
|
||||||
|
|
||||||
|
Remove-DesktopIcon "*Epic Games*";
|
||||||
|
Remove-DesktopIcon "*Steam*";
|
||||||
|
Remove-DesktopIcon "*PPSSPP *-Bit*";
|
||||||
|
|
||||||
|
Install-ChocoPackage ubisoft-connect -ArgumentList "--ignore-checksums";
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
};
|
||||||
}
|
}
|
||||||
([SetupStage]::Install) {
|
|
||||||
Write-Host "Entering install phase";
|
switch (Get-Stage) {
|
||||||
Deploy-SoftwareAction;
|
([SetupStage]::Configure) {
|
||||||
Set-Stage ([SetupStage]::CreateUser);
|
if (Get-Config "valhalla.windows.dualboot.enable") {
|
||||||
}
|
# Fix synchronization between Linux and Windows clocks.
|
||||||
([SetupStage]::CreateUser) {
|
Set-ItemProperty "HKLM:\SYSTEM\CurrentControlSet\Control\TimeZoneInformation" -Name "RealTimeIsUniversal" -Value 1 -Type "DWord";
|
||||||
Start-ValhallaUserSetup;
|
|
||||||
Set-IsFinished $true;
|
# Force time resynchronization
|
||||||
|
$service = Get-Service W32Time;
|
||||||
|
$stopped = ($service.Status -eq "Stopped");
|
||||||
|
Start-Service $service;
|
||||||
|
w32tm /resync /force;
|
||||||
|
|
||||||
|
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;
|
||||||
|
Disable-BootMessage;
|
||||||
|
|
||||||
|
if ($currentUser -lt $users.Count) {
|
||||||
|
$user = Get-LocalUser $users[$currentUser];
|
||||||
|
|
||||||
|
Add-LocalGroupMember `
|
||||||
|
-SID ([SecurityIdentifier]::new([WellKnownSidType]::BuiltinAdministratorsSid, $null))`
|
||||||
|
$user `
|
||||||
|
-ErrorAction SilentlyContinue;
|
||||||
|
|
||||||
|
if ($env:UserName -ne "$user") {
|
||||||
|
Disable-LocalUser $env:UserName;
|
||||||
|
Enable-LocalUser $user;
|
||||||
|
|
||||||
|
if (Get-UserConfig -UserName "$user" -Name "microsoftAccount") {
|
||||||
|
Enable-UAC;
|
||||||
|
Disable-Autologin;
|
||||||
|
Set-BootMessage -Caption "Login" -Message "Please login using your account.";
|
||||||
|
} else {
|
||||||
|
Set-AutologinUser "$user";
|
||||||
|
}
|
||||||
|
|
||||||
|
Restart-Intermediate -DefaultUser;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Set-IsFinished $true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,7 +61,6 @@ $null = New-Module {
|
||||||
[System.Xml.XmlNode] $association = $null;
|
[System.Xml.XmlNode] $association = $null;
|
||||||
$document = Get-DefaultAppAssociations;
|
$document = Get-DefaultAppAssociations;
|
||||||
$candidates = $document.SelectNodes((& $getSelector $Identifier));
|
$candidates = $document.SelectNodes((& $getSelector $Identifier));
|
||||||
Write-Host "Number of potential associations: $($candidates.Count)"
|
|
||||||
|
|
||||||
if ($candidates.Count -eq 1) {
|
if ($candidates.Count -eq 1) {
|
||||||
$association = $candidates[0];
|
$association = $candidates[0];
|
||||||
|
|
|
@ -1,17 +1,41 @@
|
||||||
using namespace Microsoft.Win32;
|
using namespace Microsoft.Win32;
|
||||||
|
|
||||||
$null = New-Module {
|
$null = New-Module {
|
||||||
|
. "$PSScriptRoot/../Scripts/Registry.ps1";
|
||||||
|
. "$PSScriptRoot/../../Common/Scripts/Config.ps1";
|
||||||
. "$PSScriptRoot/../../Common/Scripts/Scripting.ps1";
|
. "$PSScriptRoot/../../Common/Scripts/Scripting.ps1";
|
||||||
[RegistryKey] $key = $null;
|
[RegistryKey] $key = $null;
|
||||||
$runOncePath = "HKLM:\Software\Microsoft\Windows\CurrentVersion\RunOnce";
|
$runOncePath = "Software\Microsoft\Windows\CurrentVersion\RunOnce";
|
||||||
|
$systemRunOncePath = "HKLM:\$runOncePath";
|
||||||
|
$logonPath = "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon"
|
||||||
$runOnceName = "PortValhalla";
|
$runOnceName = "PortValhalla";
|
||||||
|
$autologinOption = "AutoAdminLogon";
|
||||||
|
$domainOption = "DefaultDomainName";
|
||||||
|
$userOption = "DefaultUserName";
|
||||||
|
$passwordOption = "DefaultPassword";
|
||||||
|
|
||||||
<#
|
<#
|
||||||
.SYNOPSIS
|
.SYNOPSIS
|
||||||
Gets the reghistry key containing the `RunOnce` commands.
|
Gets the reghistry key containing the `RunOnce` commands.
|
||||||
#>
|
#>
|
||||||
function Get-RunOnceKey {
|
function Get-RunOnceKey {
|
||||||
Get-Item $runOncePath;
|
param(
|
||||||
|
[RegistryKey] $UserKey
|
||||||
|
)
|
||||||
|
|
||||||
|
[string] $path;
|
||||||
|
|
||||||
|
if ($UserKey) {
|
||||||
|
$path = "$($UserKey.PSPath)\$runOncePath";
|
||||||
|
} else {
|
||||||
|
$path = $systemRunOncePath;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (-not (Test-Path $path)) {
|
||||||
|
New-Item $path;
|
||||||
|
} else {
|
||||||
|
Get-Item $path;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
<#
|
<#
|
||||||
|
@ -23,15 +47,34 @@ $null = New-Module {
|
||||||
#>
|
#>
|
||||||
function Register-Setup {
|
function Register-Setup {
|
||||||
param(
|
param(
|
||||||
|
[Parameter(ParameterSetName="System")]
|
||||||
|
[switch] $System,
|
||||||
|
[Parameter(ParameterSetName="User",Mandatory)]
|
||||||
|
[switch] $User,
|
||||||
|
[Parameter(Mandatory)]
|
||||||
[RegistryKey] $UserKey
|
[RegistryKey] $UserKey
|
||||||
)
|
)
|
||||||
|
|
||||||
$key = Get-RunOnceKey $UserKey;
|
if ($User.IsPresent) {
|
||||||
|
if (-not $UserKey) {
|
||||||
|
$UserKey = Get-Item "HKCU:\";
|
||||||
|
}
|
||||||
|
|
||||||
|
$key = Get-RunOnceKey $UserKey;
|
||||||
|
} else {
|
||||||
|
$key = Get-RunOnceKey;
|
||||||
|
}
|
||||||
|
|
||||||
Set-ItemProperty -Path $key.PSPath -Name $runOnceName -Type "ExpandString" -Value (
|
Set-ItemProperty -Path $key.PSPath -Name $runOnceName -Type "ExpandString" -Value (
|
||||||
"pwsh -Command " +
|
"pwsh -Command " +
|
||||||
"`$env:PWSH_PATH = $(ConvertTo-Injection $env:PWSH_PATH);" +
|
(& {
|
||||||
"`$env:INSTALLER_SCRIPT = $(ConvertTo-Injection $env:INSTALLER_SCRIPT);" +
|
if ($env:PWSH_PATH) {
|
||||||
|
"`$env:PWSH_PATH = $(ConvertTo-Injection $env:PWSH_PATH);"
|
||||||
|
} else {
|
||||||
|
""
|
||||||
|
}
|
||||||
|
}) +
|
||||||
|
"`$env:INSTALLER_SCRIPT = $(ConvertTo-Injection (Resolve-Path $env:INSTALLER_SCRIPT));" +
|
||||||
"`$env:CONFIG_MODULE = $(ConvertTo-Injection $env:CONFIG_MODULE);" +
|
"`$env:CONFIG_MODULE = $(ConvertTo-Injection $env:CONFIG_MODULE);" +
|
||||||
"& `$env:INSTALLER_SCRIPT;"
|
"& `$env:INSTALLER_SCRIPT;"
|
||||||
);
|
);
|
||||||
|
@ -39,12 +82,79 @@ $null = New-Module {
|
||||||
$key.Handle.Close();
|
$key.Handle.Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
<#
|
||||||
|
.SYNOPSIS
|
||||||
|
Sets the user to login automatically on boot.
|
||||||
|
|
||||||
|
.PARAMETER Name
|
||||||
|
The name of the user to login automatically.
|
||||||
|
#>
|
||||||
|
function Set-AutologinUser {
|
||||||
|
param(
|
||||||
|
[string] $Name
|
||||||
|
)
|
||||||
|
|
||||||
|
Set-ItemProperty $autologinOption -Name $autologinOption "1";
|
||||||
|
|
||||||
|
if (-not $Name) {
|
||||||
|
$Name = Get-SetupUser;
|
||||||
|
}
|
||||||
|
|
||||||
|
$options = @{
|
||||||
|
$domainOption = "";
|
||||||
|
$userOption = $Name;
|
||||||
|
$passwordOption = "";
|
||||||
|
};
|
||||||
|
|
||||||
|
foreach ($key in $options.Keys) {
|
||||||
|
Set-ItemProperty -Name $key
|
||||||
|
$displayName = Get-UserConfig -UserName $name "displayName";
|
||||||
|
|
||||||
|
$userArguments = @{
|
||||||
|
name = $name;
|
||||||
|
};
|
||||||
|
|
||||||
|
if ($displayName) {
|
||||||
|
$userArguments.fullName = $displayName;
|
||||||
|
} -Value $options[$key];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
<#
|
||||||
|
.SYNOPSIS
|
||||||
|
Disables the automatic login.
|
||||||
|
#>
|
||||||
|
function Disable-Autologin {
|
||||||
|
Set-ItemProperty $logonPath -Name $autologinOption "0";
|
||||||
|
|
||||||
|
foreach ($key in @($domainOption, $userOption, $passwordOption)) {
|
||||||
|
Remove-ItemProperty $logonPath -Name $key -ErrorAction SilentlyContinue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
<#
|
<#
|
||||||
.SYNOPSIS
|
.SYNOPSIS
|
||||||
Reboots the machine intermediately and restarts the setup after the next login.
|
Reboots the machine intermediately and restarts the setup after the next login.
|
||||||
#>
|
#>
|
||||||
function Restart-Intermediate {
|
function Restart-Intermediate {
|
||||||
Register-Setup;
|
param(
|
||||||
Restart-Computer;
|
[switch] $DefaultUser
|
||||||
|
)
|
||||||
|
|
||||||
|
$register = { param($Key) Register-Setup -UserKey $Key; };
|
||||||
|
|
||||||
|
if ($DefaultUser) {
|
||||||
|
Edit-DefaultUserKey {
|
||||||
|
param(
|
||||||
|
[RegistryKey] $Key
|
||||||
|
)
|
||||||
|
|
||||||
|
& $register -Key $Key;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
& $register;
|
||||||
|
Read-Host "Press enter to reboot";
|
||||||
|
Restart-Computer -Force;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,4 +16,41 @@ $null = New-Module {
|
||||||
[System.GC]::Collect();
|
[System.GC]::Collect();
|
||||||
& reg unload $regRootPath;
|
& reg unload $regRootPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
<#
|
||||||
|
.SYNOPSIS
|
||||||
|
Sets a message to show on the login screen.
|
||||||
|
|
||||||
|
.PARAMETER Caption
|
||||||
|
The title of the message.
|
||||||
|
|
||||||
|
.PARAMETER Message
|
||||||
|
The text of the message.
|
||||||
|
#>
|
||||||
|
function Set-BootMessage {
|
||||||
|
param(
|
||||||
|
[string] $Caption,
|
||||||
|
[string] $Message
|
||||||
|
)
|
||||||
|
|
||||||
|
$options = @{
|
||||||
|
legalnoticecaption = $Caption;
|
||||||
|
legalnoticetext = $Message;
|
||||||
|
};
|
||||||
|
|
||||||
|
foreach ($key in $options.Keys) {
|
||||||
|
Set-ItemProperty "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System" `
|
||||||
|
-Name $key `
|
||||||
|
-Type "String" `
|
||||||
|
-Value ($options[$key]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
<#
|
||||||
|
.SYNOPSIS
|
||||||
|
Disables the boot message.
|
||||||
|
#>
|
||||||
|
function Disable-BootMessage {
|
||||||
|
Set-BootMessage;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
36
scripts/Windows/Scripts/Security.ps1
Normal file
36
scripts/Windows/Scripts/Security.ps1
Normal file
|
@ -0,0 +1,36 @@
|
||||||
|
$null = New-Module {
|
||||||
|
$uacOption = "EnableLUA";
|
||||||
|
$systemPolicyPath = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System";
|
||||||
|
|
||||||
|
$uacSetter = {
|
||||||
|
param(
|
||||||
|
[bool] $Value
|
||||||
|
)
|
||||||
|
|
||||||
|
Set-ItemProperty -Path $systemPolicyPath -Name $uacOption -Value ([int]$Value);
|
||||||
|
}
|
||||||
|
|
||||||
|
<#
|
||||||
|
.SYNOPSIS
|
||||||
|
Determines whether UAC is enabled.
|
||||||
|
#>
|
||||||
|
function Get-UACStatus {
|
||||||
|
[bool](Get-ItemProperty -Path $systemPolicyPath -Name $uacOption);
|
||||||
|
}
|
||||||
|
|
||||||
|
<#
|
||||||
|
.SYNOPSIS
|
||||||
|
Enables UAC.
|
||||||
|
#>
|
||||||
|
function Enable-UAC {
|
||||||
|
& $uacSetter $true;
|
||||||
|
}
|
||||||
|
|
||||||
|
<#
|
||||||
|
.SYNOPSIS
|
||||||
|
Disables UAC.
|
||||||
|
#>
|
||||||
|
function Disable-UAC {
|
||||||
|
& $uacSetter $false;
|
||||||
|
}
|
||||||
|
};
|
|
@ -57,7 +57,7 @@ $null = New-Module {
|
||||||
"So sorry…") -join "`n");
|
"So sorry…") -join "`n");
|
||||||
|
|
||||||
Write-Host "Create a user for ``$Name`` manually (because Windows is too stupid)…";
|
Write-Host "Create a user for ``$Name`` manually (because Windows is too stupid)…";
|
||||||
Read-Host "Hit enter once you're done";
|
$null = Read-Host "Hit enter once you're done";
|
||||||
|
|
||||||
$newUsers = @(Get-LocalUser | Where-Object { -not ($currentUsers -contains $_.Name) });
|
$newUsers = @(Get-LocalUser | Where-Object { -not ($currentUsers -contains $_.Name) });
|
||||||
|
|
||||||
|
@ -96,7 +96,8 @@ $null = New-Module {
|
||||||
return $newUsers[$result - 1];
|
return $newUsers[$result - 1];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
Write-Host "";
|
||||||
Write-Host "Unable to determine the new user";
|
Write-Host "Unable to determine the new user";
|
||||||
Write-Host "Retrying…";
|
Write-Host "Retrying…";
|
||||||
}
|
}
|
||||||
|
@ -111,22 +112,23 @@ $null = New-Module {
|
||||||
Set-SetupOption $userOption $i;
|
Set-SetupOption $userOption $i;
|
||||||
$name = $users[$i];
|
$name = $users[$i];
|
||||||
Write-Host "Creating personal user ``$name``…";
|
Write-Host "Creating personal user ``$name``…";
|
||||||
|
$displayName = Get-UserConfig -UserName $name "displayName";
|
||||||
|
|
||||||
|
$userArguments = @{
|
||||||
|
name = $name;
|
||||||
|
};
|
||||||
|
|
||||||
|
if ($displayName) {
|
||||||
|
$userArguments.fullName = $displayName;
|
||||||
|
}
|
||||||
|
|
||||||
if (Get-UserConfig -UserName $name "microsoftAccount") {
|
if (Get-UserConfig -UserName $name "microsoftAccount") {
|
||||||
Add-MicrosoftAccount $name;
|
Add-MicrosoftAccount $name;
|
||||||
} else {
|
} else {
|
||||||
$displayName = Get-UserConfig -UserName $name "displayName";
|
New-LocalUser -Disabled -NoPassword @userArguments;
|
||||||
|
|
||||||
$userArguments = @{
|
|
||||||
name = $name;
|
|
||||||
};
|
|
||||||
|
|
||||||
if ($displayName) {
|
|
||||||
$userArguments.fullName = $displayName;
|
|
||||||
}
|
|
||||||
|
|
||||||
New-LocalUser -NoPassword @userArguments;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Set-LocalUser @userArguments;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -4,10 +4,12 @@ param(
|
||||||
)
|
)
|
||||||
|
|
||||||
. "$PSScriptRoot/../../../Common/Scripts/Software.ps1";
|
. "$PSScriptRoot/../../../Common/Scripts/Software.ps1";
|
||||||
|
. "$PSScriptRoot/../../../Common/Scripts/System.ps1";
|
||||||
|
|
||||||
Start-SoftwareInstaller @PSBoundParameters `
|
Start-SoftwareInstaller @PSBoundParameters `
|
||||||
-Installer {
|
-Installer {
|
||||||
Install-WingetPackage Nadeo.ManiaPlanet;
|
Install-WingetPackage Nadeo.ManiaPlanet;
|
||||||
|
Remove-DesktopIcon "ManiaPlanet*";
|
||||||
};
|
};
|
||||||
|
|
||||||
# ToDo: Add restoration
|
# ToDo: Add restoration
|
||||||
|
|
|
@ -5,8 +5,8 @@ param(
|
||||||
[hashtable] $Arguments
|
[hashtable] $Arguments
|
||||||
)
|
)
|
||||||
|
|
||||||
. "$PSScriptRoot/../../Scripts/Software.ps1";
|
. "$PSScriptRoot/../../Scripts/AppAssociations.ps1";
|
||||||
. "$PSScriptRoot/../../../Common/Scripts/AppAssociations.ps1";
|
. "$PSScriptRoot/../../../Common/Scripts/Software.ps1";
|
||||||
|
|
||||||
Start-SoftwareInstaller @PSBoundParameters `
|
Start-SoftwareInstaller @PSBoundParameters `
|
||||||
-Installer {
|
-Installer {
|
||||||
|
|
|
@ -21,9 +21,10 @@ $null = New-Module {
|
||||||
$packageName = $version[0];
|
$packageName = $version[0];
|
||||||
Write-Host "Installing ``$packageName``…";
|
Write-Host "Installing ``$packageName``…";
|
||||||
Install-ChocoPackage $packageName;
|
Install-ChocoPackage $packageName;
|
||||||
Remove-DesktopIcon "CocosCreator*";
|
|
||||||
Remove-DesktopIcon "Unity Hub*";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Remove-DesktopIcon "CocosCreator*";
|
||||||
|
Remove-DesktopIcon "Unity Hub*";
|
||||||
};
|
};
|
||||||
|
|
||||||
# ToDo: Add restoration
|
# ToDo: Add restoration
|
||||||
|
|
Loading…
Reference in a new issue