2024-08-05 18:07:39 +00:00
|
|
|
using namespace Microsoft.Win32;
|
|
|
|
|
2024-08-07 19:05:32 +00:00
|
|
|
. "$PSScriptRoot/../../../Common/Scripts/Software.ps1";
|
|
|
|
. "$PSScriptRoot/../../../Common/Types/InstallerAction.ps1";
|
2024-08-05 18:07:39 +00:00
|
|
|
|
2024-08-28 02:40:00 +00:00
|
|
|
& {
|
|
|
|
. "$PSScriptRoot/../../Scripts/Registry.ps1";
|
|
|
|
. "$PSScriptRoot/../../Scripts/Restoration.ps1";
|
|
|
|
. "$PSScriptRoot/../../../Common/Scripts/Config.ps1";
|
|
|
|
. "$PSScriptRoot/../../../Common/Scripts/System.ps1";
|
|
|
|
|
|
|
|
$userFolders = @(
|
|
|
|
"Pictures",
|
|
|
|
"Documents",
|
|
|
|
"Downloads",
|
|
|
|
"Music",
|
|
|
|
"Videos"
|
|
|
|
);
|
|
|
|
|
|
|
|
$userExclusions = @(
|
|
|
|
"Documents/Eigene*",
|
|
|
|
"Documents/My Games",
|
|
|
|
"Documents/My Music",
|
|
|
|
"Documents/My Pictures",
|
|
|
|
"Documents/My Videos"
|
|
|
|
);
|
|
|
|
|
|
|
|
[string[]] $homeExclusions = Get-Content "$PSScriptRoot/Home.exclude.txt";
|
|
|
|
|
2024-10-13 20:07:44 +00:00
|
|
|
Start-SoftwareInstaller -Force @args `
|
2024-08-28 02:40:00 +00:00
|
|
|
-Backup {
|
|
|
|
Add-BackupArtifacts -Source "$env:PUBLIC" -Path "Public" `
|
|
|
|
-Include ($userFolders) `
|
|
|
|
-Exclude ($userExclusions + @("Documents/Hyper-V", "Documents/reWASD"));
|
|
|
|
} `
|
|
|
|
-Configurator {
|
|
|
|
$dir = New-TemporaryDirectory;
|
|
|
|
Push-Location $dir;
|
|
|
|
|
|
|
|
# Copy keyboard layout
|
|
|
|
# ToDo: Why not NewUser? Investiagte!
|
|
|
|
Copy-UserInternationalSettingsToSystem -WelcomeScreen $True -NewUser $False;
|
|
|
|
|
2024-09-22 15:50:05 +00:00
|
|
|
if (Get-OSConfig "legacyIconSpacing") {
|
2024-08-28 02:40:00 +00:00
|
|
|
Write-Host "Setting up old-school Desktop Icon spacing";
|
|
|
|
|
|
|
|
Edit-DefaultUserKey {
|
|
|
|
param (
|
|
|
|
[RegistryKey] $Key
|
|
|
|
)
|
|
|
|
|
|
|
|
$property = "IconSpacing";
|
|
|
|
$relativePath = "Control Panel\Desktop\WindowMetrics"
|
|
|
|
$path = "$($Key.PSPath)\$relativePath";
|
|
|
|
Copy-ItemProperty "HKCU:\$relativePath" $path $property;
|
|
|
|
Rename-ItemProperty $path $property "_$property";
|
|
|
|
Set-ItemProperty $path -Name $property -Value "-1710" -Type "String";
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2024-09-22 15:50:05 +00:00
|
|
|
if (-not (Get-OSConfig "dynamicLighting")) {
|
2024-08-28 02:40:00 +00:00
|
|
|
Write-Host "Disabling Dynamic Lighting";
|
|
|
|
|
|
|
|
Edit-DefaultUserKey {
|
|
|
|
param (
|
|
|
|
[RegistryKey] $Key
|
|
|
|
)
|
|
|
|
|
|
|
|
$path = "$($Key.PSPath)\Software\Microsoft\Lighting";
|
|
|
|
$null = New-Item $path -ErrorAction SilentlyContinue;
|
|
|
|
Set-ItemProperty $path -Name "AmbientLightingEnabled" -Value 0 -Type "DWord";
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2024-09-22 15:50:05 +00:00
|
|
|
if (-not (Get-OSConfig "adware")) {
|
2024-08-28 02:40:00 +00:00
|
|
|
$startLayoutFile = "start.json";
|
|
|
|
Write-Host "Removing adware";
|
|
|
|
|
|
|
|
Remove-DesktopIcon "*Microsoft Edge*";
|
|
|
|
|
|
|
|
Edit-DefaultUserKey {
|
|
|
|
param (
|
|
|
|
[RegistryKey] $Key
|
|
|
|
)
|
|
|
|
|
|
|
|
$winKey = "$($Key.PSPath)\Software\Microsoft\Windows\CurrentVersion";
|
|
|
|
$contentDeliveryKey = "$winKey\ContentDeliveryManager";
|
|
|
|
$cloudContentKey = "HKLM:\Software\Policies\Microsoft\Windows\CloudContent";
|
|
|
|
|
|
|
|
foreach ($path in @($contentDeliveryKey, $cloudContentKey)) {
|
|
|
|
if (-not (Test-Path $path)) {
|
|
|
|
$null = New-Item $path;
|
|
|
|
}
|
2024-08-05 18:07:39 +00:00
|
|
|
}
|
2024-08-05 21:22:22 +00:00
|
|
|
|
2024-08-28 02:40:00 +00:00
|
|
|
# Set-ItemProperty $cloudContentKey -Name "DisableWindowsConsumerFeatures" -Value 1 -Type "DWord";
|
|
|
|
Set-ItemProperty $cloudContentKey -Name "DisableCloudOptimizedContent" -Value 1 -Type "DWord";
|
|
|
|
Set-ItemProperty $cloudContentKey -Name "DisableConsumerAccountStateContent" -Value 1 -Type "DWord";
|
|
|
|
|
|
|
|
# Disabling Personal MS Teams Icon
|
|
|
|
Set-ItemProperty "$winKey\Explorer\Advanced" -Name "TaskBarMn" -Value 0 -Type "DWord";
|
|
|
|
Set-ItemProperty $contentDeliveryKey -Name "ContentDeliveryAllowed" -Value 0 -Type "DWord";
|
|
|
|
Set-ItemProperty $contentDeliveryKey -Name "SilentInstalledAppsEnabled" -Value 0 -Type "DWord";
|
|
|
|
Set-ItemProperty $contentDeliveryKey -Name "SystemPaneSuggestionsEnabled" -Value 0 -Type "DWord";
|
|
|
|
};
|
|
|
|
|
|
|
|
Write-Host "Removing ads from pinned apps";
|
|
|
|
Export-StartLayout $startLayoutFile;
|
|
|
|
|
|
|
|
$startLayout = Get-Content $startLayoutFile | ConvertFrom-Json;
|
|
|
|
$property = "pinnedList";
|
|
|
|
|
|
|
|
$newLayout = $startLayout | Select-Object -ExpandProperty $property | Where-Object {
|
|
|
|
-not (
|
|
|
|
($_.desktopAppLink -like "*Microsoft Edge*") -or
|
|
|
|
[System.Linq.Enumerable]::Any(
|
|
|
|
@(
|
|
|
|
"*MicrosoftOfficeHub*",
|
|
|
|
"*SpotifyMusic*",
|
|
|
|
"*WhatsApp*",
|
|
|
|
"*PrimeVideo*",
|
|
|
|
"*Netflix*",
|
|
|
|
"*Instagram*",
|
|
|
|
"*ChipChamp*",
|
|
|
|
"*Facebook*",
|
|
|
|
"*LinkedIn*"),
|
2024-10-06 19:25:34 +00:00
|
|
|
[System.Func[System.Object, bool]] {
|
2024-08-28 02:40:00 +00:00
|
|
|
param($pattern)
|
|
|
|
$_.packagedAppId -like "$pattern";
|
|
|
|
}));
|
|
|
|
};
|
|
|
|
|
|
|
|
$startLayout.PSObject.Properties.Remove($property);
|
|
|
|
$startLayout | Add-Member -NotePropertyName $property -NotePropertyValue $newLayout;
|
|
|
|
|
|
|
|
$startLayout | ConvertTo-Json -Compress | Set-Content "$env:SystemDrive\Users\Default\AppData\Local\Microsoft\Windows\Shell\LayoutModification.json";
|
|
|
|
}
|
|
|
|
|
2024-09-22 15:50:05 +00:00
|
|
|
if (Get-OSConfig "showFileExt") {
|
2024-08-28 02:40:00 +00:00
|
|
|
Edit-DefaultUserKey {
|
|
|
|
param (
|
|
|
|
[RegistryKey] $Key
|
|
|
|
)
|
|
|
|
|
|
|
|
Set-ItemProperty "$($Key.PSPath)\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name "HideFileExt" -Value 0 -Type "DWord";
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
Pop-Location;
|
|
|
|
Remove-Item -Recurse $dir;
|
|
|
|
Expand-BackupArtifacts -Path "Public" -Target $env:PUBLIC;
|
|
|
|
} `
|
|
|
|
-UserBackup {
|
|
|
|
param(
|
|
|
|
[hashtable] $Arguments
|
|
|
|
)
|
|
|
|
|
|
|
|
Add-BackupArtifacts -User $Arguments.Name -Source $HOME -Path "Home" -Include ($userFolders) -Exclude ($userExclusions + $homeExclusions);
|
|
|
|
} `
|
|
|
|
-UserConfigurator {
|
|
|
|
param(
|
|
|
|
[hashtable] $Arguments
|
|
|
|
)
|
2024-08-05 21:22:22 +00:00
|
|
|
|
2024-08-28 02:40:00 +00:00
|
|
|
Expand-BackupArtifacts -User $Arguments.Name -Path "Home" -Target $HOME;
|
|
|
|
};
|
2024-09-30 03:00:20 +00:00
|
|
|
} @args;
|