diff --git a/Main.cs b/Main.cs
index f452fad..3e4776b 100644
--- a/Main.cs
+++ b/Main.cs
@@ -434,6 +434,7 @@ public void RestartExplorer()
public string GetScript()
{
StringWriter writer = new();
+
void WriteScriptBlock(string command)
{
writer.WriteLine("\t{");
@@ -443,6 +444,7 @@ void WriteScriptBlock(string command)
}
writer.WriteLine("\t};");
}
+
writer.WriteLine("$scripts = @(");
foreach (string command in commands)
{
@@ -471,7 +473,7 @@ void WriteScriptBlock(string command)
///
/// Collects PowerShell commands that will be run whenever a user logs on for the first time.
///
-public class UserOnceScriptSequence : PowerShellSequence
+public class UserOnceSequence : PowerShellSequence
{
protected override string Activity()
{
@@ -500,6 +502,22 @@ protected override string LogFile()
}
}
+///
+/// Collects PowerShell commands that modify the default user's registry hive.
+///
+public class DefaultUserSequence : PowerShellSequence
+{
+ protected override string Activity()
+ {
+ return "Running scripts to modify the default user’’s registry hive.";
+ }
+
+ protected override string LogFile()
+ {
+ return @"C:\Windows\Setup\Scripts\DefaultUser.log";
+ }
+}
+
public interface IKeyed
{
string Id { get; }
@@ -910,7 +928,8 @@ public XmlDocument GenerateXml(Configuration config)
NamespaceManager: ns,
Generator: this,
FirstLogonScript: new FirstLogonSequence(),
- UserOnceScript: new UserOnceScriptSequence()
+ UserOnceScript: new UserOnceSequence(),
+ DefaultUserScript: new DefaultUserSequence()
);
new List {
@@ -932,8 +951,9 @@ public XmlDocument GenerateXml(Configuration config)
new TimeZoneModifier(context),
new WdacModifier(context),
new ScriptModifier(context),
- new FirstLogonModifier(context),
new UserOnceModifier(context),
+ new DefaultUserModifier(context),
+ new FirstLogonModifier(context),
new OrderModifier(context),
new ProcessorArchitectureModifier(context),
new PrettyModifier(context),
@@ -982,7 +1002,8 @@ public record class ModifierContext(
Configuration Configuration,
UnattendGenerator Generator,
FirstLogonSequence FirstLogonScript,
- UserOnceScriptSequence UserOnceScript
+ UserOnceSequence UserOnceScript,
+ DefaultUserSequence DefaultUserScript
);
abstract class Modifier(ModifierContext context)
@@ -997,7 +1018,9 @@ abstract class Modifier(ModifierContext context)
public FirstLogonSequence FirstLogonScript { get; } = context.FirstLogonScript;
- public UserOnceScriptSequence UserOnceScript { get; } = context.UserOnceScript;
+ public UserOnceSequence UserOnceScript { get; } = context.UserOnceScript;
+
+ public DefaultUserSequence DefaultUserScript { get; } = context.DefaultUserScript;
public XmlElement NewSimpleElement(string name, XmlElement parent, string innerText)
{
diff --git a/modifier/Bloatware.cs b/modifier/Bloatware.cs
index 0afd98f..c7fe689 100644
--- a/modifier/Bloatware.cs
+++ b/modifier/Bloatware.cs
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
+using System.Globalization;
using System.IO;
using System.Linq;
@@ -192,12 +193,7 @@ public override void Process()
CommandBuilder.ShellCommand(@"del ""C:\Windows\System32\OneDriveSetup.exe"""),
CommandBuilder.ShellCommand(@"del ""C:\Windows\SysWOW64\OneDriveSetup.exe"""),
]);
- appender.Append(
- CommandBuilder.RegistryDefaultUserCommand((rootKey, subKey) =>
- {
- return [CommandBuilder.RegistryCommand(@$"delete ""{rootKey}\{subKey}\Software\Microsoft\Windows\CurrentVersion\Run"" /v OneDriveSetup /f")];
- })
- );
+ DefaultUserScript.Append(@"Remove-ItemProperty -LiteralPath 'Registry::HKU\DefaultUser\Software\Microsoft\Windows\CurrentVersion\Run' -Name 'OneDriveSetup' -Force -ErrorAction 'Continue';");
break;
case CustomBloatwareStep when bw.Id == "RemoveTeams":
appender.Append(
@@ -205,12 +201,7 @@ public override void Process()
);
break;
case CustomBloatwareStep when bw.Id == "RemoveNotepad":
- appender.Append(
- CommandBuilder.RegistryDefaultUserCommand((rootKey, subKey) =>
- {
- return [CommandBuilder.RegistryCommand(@$"add ""{rootKey}\{subKey}\Software\Microsoft\Notepad"" /v ShowStoreBanner /t REG_DWORD /d 0 /f")];
- })
- );
+ DefaultUserScript.Append(@$"reg.exe add ""HKU\DefaultUser\Software\Microsoft\Notepad"" /v ShowStoreBanner /t REG_DWORD /d 0 /f;");
break;
case CustomBloatwareStep when bw.Id == "RemoveOutlook":
appender.Append(
@@ -224,14 +215,7 @@ public override void Process()
break;
case CustomBloatwareStep when bw.Id == "RemoveCopilot":
UserOnceScript.Append("Get-AppxPackage -Name 'Microsoft.Windows.Ai.Copilot.Provider' | Remove-AppxPackage;");
- appender.Append(
- CommandBuilder.RegistryDefaultUserCommand((rootKey, subKey) =>
- {
- return [
- CommandBuilder.RegistryCommand(@$"add ""{rootKey}\{subKey}\Software\Policies\Microsoft\Windows\WindowsCopilot"" /v TurnOffWindowsCopilot /t REG_DWORD /d 1 /f")
- ];
- })
- );
+ DefaultUserScript.Append(@$"reg.exe add ""HKU\DefaultUser\Software\Policies\Microsoft\Windows\WindowsCopilot"" /v TurnOffWindowsCopilot /t REG_DWORD /d 1 /f;");
break;
default:
throw new NotSupportedException();
diff --git a/modifier/DefaultUser.cs b/modifier/DefaultUser.cs
new file mode 100644
index 0000000..2936eb6
--- /dev/null
+++ b/modifier/DefaultUser.cs
@@ -0,0 +1,20 @@
+namespace Schneegans.Unattend;
+
+class DefaultUserModifier(ModifierContext context) : Modifier(context)
+{
+ public override void Process()
+ {
+ if (DefaultUserScript.IsEmpty)
+ {
+ return;
+ }
+ CommandAppender appender = GetAppender(CommandConfig.Specialize);
+ string script = DefaultUserScript.GetScript();
+ string ps1File = @"C:\Windows\Setup\Scripts\DefaultUser.ps1";
+ AddTextFile(script, ps1File);
+
+ appender.Append(CommandBuilder.RegistryCommand(@"load ""HKU\DefaultUser"" ""C:\Users\Default\NTUSER.DAT"""));
+ appender.Append(CommandBuilder.InvokePowerShellScript(ps1File));
+ appender.Append(CommandBuilder.RegistryCommand(@"unload ""HKU\DefaultUser"""));
+ }
+}
\ No newline at end of file
diff --git a/modifier/Optimizations.cs b/modifier/Optimizations.cs
index 980e214..7ab0fce 100644
--- a/modifier/Optimizations.cs
+++ b/modifier/Optimizations.cs
@@ -1,8 +1,6 @@
using Newtonsoft.Json;
using System;
-using System.Collections.Generic;
using System.IO;
-using System.Linq;
using System.Xml;
namespace Schneegans.Unattend;
@@ -71,28 +69,22 @@ public override void Process()
{
CommandAppender appender = GetAppender(CommandConfig.Specialize);
+ if (Configuration.ShowFileExtensions)
{
- IEnumerable SetExplorerOptions(string rootKey, string subKey)
- {
- if (Configuration.ShowFileExtensions)
- {
- yield return CommandBuilder.RegistryCommand(@$"add ""{rootKey}\{subKey}\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced"" /v ""HideFileExt"" /t REG_DWORD /d 0 /f");
- }
+ DefaultUserScript.Append(@$"reg.exe add ""HKU\DefaultUser\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced"" /v ""HideFileExt"" /t REG_DWORD /d 0 /f;");
+ }
- switch (Configuration.HideFiles)
- {
- case HideModes.None:
- yield return CommandBuilder.RegistryCommand(@$"add ""{rootKey}\{subKey}\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced"" /v ""Hidden"" /t REG_DWORD /d 1 /f");
- yield return CommandBuilder.RegistryCommand(@$"add ""{rootKey}\{subKey}\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced"" /v ""ShowSuperHidden"" /t REG_DWORD /d 1 /f");
- break;
- case HideModes.HiddenSystem:
- yield return CommandBuilder.RegistryCommand(@$"add ""{rootKey}\{subKey}\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced"" /v ""Hidden"" /t REG_DWORD /d 1 /f");
- break;
- case HideModes.Hidden:
- break;
- }
- }
- appender.Append(CommandBuilder.RegistryDefaultUserCommand(SetExplorerOptions));
+ switch (Configuration.HideFiles)
+ {
+ case HideModes.None:
+ DefaultUserScript.Append(@$"reg.exe add ""HKU\DefaultUser\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced"" /v ""Hidden"" /t REG_DWORD /d 1 /f;");
+ DefaultUserScript.Append(@$"reg.exe add ""HKU\DefaultUser\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced"" /v ""ShowSuperHidden"" /t REG_DWORD /d 1 /f;");
+ break;
+ case HideModes.HiddenSystem:
+ DefaultUserScript.Append(@$"reg.exe add ""HKU\DefaultUser\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced"" /v ""Hidden"" /t REG_DWORD /d 1 /f;");
+ break;
+ case HideModes.Hidden:
+ break;
}
if (Configuration.DisableWindowsUpdate)
@@ -115,9 +107,7 @@ IEnumerable SetExplorerOptions(string rootKey, string subKey)
string ps1File = @"C:\Windows\Setup\Scripts\ShowAllTrayIcons.ps1";
string script = Util.StringFromResource("ShowAllTrayIcons.ps1");
AddTextFile(script, ps1File);
- appender.Append(
- CommandBuilder.InvokePowerShellScript(ps1File)
- );
+ DefaultUserScript.InvokeFile(ps1File);
AddXmlFile(Util.XmlDocumentFromResource("ShowAllTrayIcons.xml"), @"C:\Windows\Setup\Scripts\ShowAllTrayIcons.xml");
AddTextFile(Util.StringFromResource("ShowAllTrayIcons.vbs"), @"C:\Windows\Setup\Scripts\ShowAllTrayIcons.vbs");
}
@@ -133,14 +123,7 @@ IEnumerable SetExplorerOptions(string rootKey, string subKey)
if (Configuration.HideTaskViewButton)
{
- appender.Append(
- CommandBuilder.RegistryDefaultUserCommand((rootKey, subKey) =>
- {
- return [
- CommandBuilder.RegistryCommand(@$"add ""{rootKey}\{subKey}\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced"" /v ShowTaskViewButton /t REG_DWORD /d 0 /f"),
- ];
- })
- );
+ DefaultUserScript.Append(@$"reg.exe add ""HKU\DefaultUser\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced"" /v ShowTaskViewButton /t REG_DWORD /d 0 /f;");
}
if (Configuration.DisableDefender)
@@ -168,16 +151,11 @@ IEnumerable SetExplorerOptions(string rootKey, string subKey)
CommandBuilder.RegistryCommand(@"add ""HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WTDS\Components"" /v NotifyMalicious /t REG_DWORD /d 0 /f"),
CommandBuilder.RegistryCommand(@"add ""HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WTDS\Components"" /v NotifyPasswordReuse /t REG_DWORD /d 0 /f"),
CommandBuilder.RegistryCommand(@"add ""HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WTDS\Components"" /v NotifyUnsafeApp /t REG_DWORD /d 0 /f"),
- ..CommandBuilder.RegistryDefaultUserCommand((rootKey, subKey) =>
- {
- return [
- CommandBuilder.RegistryCommand(@$"add ""{rootKey}\{subKey}\Software\Microsoft\Edge\SmartScreenEnabled"" /ve /t REG_DWORD /d 0 /f"),
- CommandBuilder.RegistryCommand(@$"add ""{rootKey}\{subKey}\Software\Microsoft\Edge\SmartScreenPuaEnabled"" /ve /t REG_DWORD /d 0 /f"),
- CommandBuilder.RegistryCommand(@$"add ""{rootKey}\{subKey}\Software\Microsoft\Windows\CurrentVersion\AppHost"" /v EnableWebContentEvaluation /t REG_DWORD /d 0 /f"),
- CommandBuilder.RegistryCommand(@$"add ""{rootKey}\{subKey}\Software\Microsoft\Windows\CurrentVersion\AppHost"" /v PreventOverride /t REG_DWORD /d 0 /f"),
- ];
- })
]);
+ DefaultUserScript.Append(@$"reg.exe add ""HKU\DefaultUser\Software\Microsoft\Edge\SmartScreenEnabled"" /ve /t REG_DWORD /d 0 /f;");
+ DefaultUserScript.Append(@$"reg.exe add ""HKU\DefaultUser\Software\Microsoft\Edge\SmartScreenPuaEnabled"" /ve /t REG_DWORD /d 0 /f;");
+ DefaultUserScript.Append(@$"reg.exe add ""HKU\DefaultUser\Software\Microsoft\Windows\CurrentVersion\AppHost"" /v EnableWebContentEvaluation /t REG_DWORD /d 0 /f;");
+ DefaultUserScript.Append(@$"reg.exe add ""HKU\DefaultUser\Software\Microsoft\Windows\CurrentVersion\AppHost"" /v PreventOverride /t REG_DWORD /d 0 /f;");
}
if (Configuration.DisableUac)
@@ -273,18 +251,10 @@ IEnumerable SetExplorerOptions(string rootKey, string subKey)
if (Configuration.TurnOffSystemSounds)
{
- appender.Append(
- CommandBuilder.RegistryDefaultUserCommand((rootKey, subKey) =>
- {
- StringWriter writer = new();
- writer.WriteLine(@$"$mountKey = '{rootKey}\{subKey}';");
- writer.WriteLine(Util.StringFromResource("TurnOffSystemSounds.ps1"));
- string ps1File = @"%TEMP%\TurnOffSystemSounds.ps1";
- AddTextFile(writer.ToString(), ps1File);
- return [
- CommandBuilder.InvokePowerShellScript(ps1File),
- ];
- }));
+ string ps1File = @"C:\Windows\Setup\Scripts\TurnOffSystemSounds.ps1";
+ string script = Util.StringFromResource("TurnOffSystemSounds.ps1");
+ AddTextFile(script, ps1File);
+ DefaultUserScript.InvokeFile(ps1File);
UserOnceScript.Append(@"Set-ItemProperty -LiteralPath 'Registry::HKCU\AppEvents\Schemes' -Name '(Default)' -Type 'String' -Value '.None';");
appender.Append([
@@ -297,33 +267,29 @@ IEnumerable SetExplorerOptions(string rootKey, string subKey)
{
// https://skanthak.homepage.t-online.de/ten.html#eighth
- appender.Append(
- CommandBuilder.RegistryDefaultUserCommand((rootKey, subKey) =>
- {
- return new List()
- {
- "ContentDeliveryAllowed",
- "FeatureManagementEnabled",
- "OEMPreInstalledAppsEnabled",
- "PreInstalledAppsEnabled",
- "PreInstalledAppsEverEnabled",
- "SilentInstalledAppsEnabled",
- "SoftLandingEnabled",
- "SubscribedContentEnabled",
- "SubscribedContent-310093Enabled",
- "SubscribedContent-338387Enabled",
- "SubscribedContent-338388Enabled",
- "SubscribedContent-338389Enabled",
- "SubscribedContent-338393Enabled",
- "SubscribedContent-353698Enabled",
- "SystemPaneSuggestionsEnabled",
- }.Select(value =>
- {
- return CommandBuilder.RegistryCommand(@$"add ""{rootKey}\{subKey}\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager"" /v ""{value}"" /t REG_DWORD /d 0 /f");
- });
- })
- );
+ DefaultUserScript.Append("""
+ $names = @(
+ 'ContentDeliveryAllowed';
+ 'FeatureManagementEnabled';
+ 'OEMPreInstalledAppsEnabled';
+ 'PreInstalledAppsEnabled';
+ 'PreInstalledAppsEverEnabled';
+ 'SilentInstalledAppsEnabled';
+ 'SoftLandingEnabled';
+ 'SubscribedContentEnabled';
+ 'SubscribedContent-310093Enabled';
+ 'SubscribedContent-338387Enabled';
+ 'SubscribedContent-338388Enabled';
+ 'SubscribedContent-338389Enabled';
+ 'SubscribedContent-338393Enabled';
+ 'SubscribedContent-353698Enabled';
+ 'SystemPaneSuggestionsEnabled';
+ );
+ foreach( $name in $names ) {
+ reg.exe add "HKU\DefaultUser\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" /v $name /t REG_DWORD /d 0 /f;
+ }
+ """);
appender.Append(
CommandBuilder.RegistryCommand(@"add ""HKLM\Software\Policies\Microsoft\Windows\CloudContent"" /v ""DisableWindowsConsumerFeatures"" /t REG_DWORD /d 0 /f")
);
@@ -379,12 +345,7 @@ IEnumerable SetExplorerOptions(string rootKey, string subKey)
if (Configuration.LeftTaskbar)
{
- appender.Append(
- CommandBuilder.RegistryDefaultUserCommand((rootKey, subKey) =>
- {
- return [CommandBuilder.RegistryCommand(@$"add ""{rootKey}\{subKey}\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced"" /v TaskbarAl /t REG_DWORD /d 0 /f")];
- })
- );
+ DefaultUserScript.Append(@$"reg.exe add ""HKU\DefaultUser\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced"" /v TaskbarAl /t REG_DWORD /d 0 /f;");
}
if (Configuration.HideEdgeFre)
@@ -411,16 +372,12 @@ IEnumerable SetExplorerOptions(string rootKey, string subKey)
{
indicators |= 4;
}
- appender.Append(
- CommandBuilder.RegistryDefaultUserCommand((rootKey, subKey) =>
- {
- return [
- CommandBuilder.RegistryCommand(@$"add ""HKU\.DEFAULT\Control Panel\Keyboard"" /v InitialKeyboardIndicators /t REG_SZ /d ""{indicators}"" /f"),
- CommandBuilder.RegistryCommand(@$"add ""{rootKey}\{subKey}\Control Panel\Keyboard"" /v InitialKeyboardIndicators /t REG_SZ /d ""{indicators}"" /f")
- ];
- }
- )
- );
+
+ DefaultUserScript.Append($$"""
+ foreach( $root in 'Registry::HKU\.DEFAULT', 'Registry::HKU\DefaultUser' ) {
+ Set-ItemProperty -LiteralPath "$root\Control Panel\Keyboard" -Name 'InitialKeyboardIndicators' -Type 'String' -Value {{indicators}} -Force;
+ }
+ """);
}
{
bool ignoreCapsLock = settings.CapsLock.Behavior == KeyBehavior.Ignore;
diff --git a/modifier/Personalization.cs b/modifier/Personalization.cs
index dbdea16..0157cd4 100644
--- a/modifier/Personalization.cs
+++ b/modifier/Personalization.cs
@@ -51,14 +51,7 @@ public override void Process()
""");
writer.WriteLine(script);
AddTextFile(writer.ToString(), ps1File);
- appender.Append(
- CommandBuilder.RegistryDefaultUserCommand((rootKey, subKey) =>
- {
- return [
- CommandBuilder.RegistryCommand(@$"add ""{rootKey}\{subKey}\SOFTWARE\Microsoft\Windows\DWM"" /v ColorPrevalence /t REG_DWORD /d {(settings.AccentColorOnBorders ? 1 : 0)} /f"),
- ];
- })
- );
+ DefaultUserScript.Append(@$"reg.exe add ""HKU\DefaultUser\Software\Microsoft\Windows\DWM"" /v ColorPrevalence /t REG_DWORD /d {(settings.AccentColorOnBorders ? 1 : 0)} /f;");
UserOnceScript.InvokeFile(ps1File);
UserOnceScript.RestartExplorer();
}
diff --git a/modifier/Script.cs b/modifier/Script.cs
index e34ef26..54fa00c 100644
--- a/modifier/Script.cs
+++ b/modifier/Script.cs
@@ -185,12 +185,7 @@ void AppendPowerShellSequence(PowerShellSequence sequence)
AppendPowerShellSequence(UserOnceScript);
break;
case ScriptPhase.DefaultUser:
- appender.Append(
- CommandBuilder.RegistryDefaultUserCommand((rootKey, subKey) =>
- {
- return [command];
- })
- );
+ AppendPowerShellSequence(DefaultUserScript);
break;
default:
throw new NotSupportedException();
@@ -212,13 +207,13 @@ public static string GetCommand(ScriptInfo info)
_ => throw new NotSupportedException(),
};
- if (info.Script.Phase == ScriptPhase.UserOnce)
+ if (info.Script.Phase == ScriptPhase.System)
{
- return inner;
+ return CommandBuilder.ShellCommand(inner, outFile: info.LogPath);
}
else
{
- return CommandBuilder.ShellCommand(inner, outFile: info.LogPath);
+ return inner;
}
}
}
\ No newline at end of file
diff --git a/modifier/UserOnce.cs b/modifier/UserOnce.cs
index 9eec7ca..550931c 100644
--- a/modifier/UserOnce.cs
+++ b/modifier/UserOnce.cs
@@ -8,22 +8,15 @@ public override void Process()
{
return;
}
- CommandAppender appender = GetAppender(CommandConfig.Specialize);
+
string script = UserOnceScript.GetScript();
string ps1File = @"C:\Windows\Setup\Scripts\UserOnce.ps1";
AddTextFile(script, ps1File);
-
- appender.Append(
- CommandBuilder.RegistryDefaultUserCommand((rootKey, subKey) =>
- {
- static string Escape(string s)
- {
- return s.Replace(@"""", @"\""");
- }
-
- string command = CommandBuilder.InvokePowerShellScript(ps1File);
- return [CommandBuilder.RegistryCommand(@$"add ""{rootKey}\{subKey}\Software\Microsoft\Windows\CurrentVersion\RunOnce"" /v ""UnattendedSetup"" /t REG_SZ /d ""{Escape(command)}"" /f")];
- })
- );
+ static string Escape(string s)
+ {
+ return s.Replace(@"""", @"\""""");
+ }
+ string command = Escape(CommandBuilder.InvokePowerShellScript(ps1File));
+ DefaultUserScript.Append(@$"reg.exe add ""HKU\DefaultUser\Software\Microsoft\Windows\CurrentVersion\RunOnce"" /v ""UnattendedSetup"" /t REG_SZ /d ""{command}"" /f;");
}
}
\ No newline at end of file
diff --git a/resource/SetColorTheme.ps1 b/resource/SetColorTheme.ps1
index 88c5f70..3891323 100644
--- a/resource/SetColorTheme.ps1
+++ b/resource/SetColorTheme.ps1
@@ -12,7 +12,7 @@
& {
Add-Type -AssemblyName 'System.Drawing';
$accentColor = [System.Drawing.ColorTranslator]::FromHtml( $htmlAccentColor );
-
+
function ConvertTo-DWord {
param(
[System.Drawing.Color]
@@ -27,7 +27,7 @@
);
return [System.BitConverter]::ToUInt32( $bytes, 0);
}
-
+
$startColor = [System.Drawing.Color]::FromArgb( 0xD2, $accentColor );
Set-ItemProperty -LiteralPath 'Registry::HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Accent' -Name 'StartColorMenu' -Value( ConvertTo-DWord -Color $accentColor ) -Type 'DWord' -Force;
Set-ItemProperty -LiteralPath 'Registry::HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Accent' -Name 'AccentColorMenu' -Value( ConvertTo-DWord -Color $accentColor ) -Type 'DWord' -Force;
diff --git a/resource/ShowAllTrayIcons.ps1 b/resource/ShowAllTrayIcons.ps1
index 51811da..d0fdbb1 100644
--- a/resource/ShowAllTrayIcons.ps1
+++ b/resource/ShowAllTrayIcons.ps1
@@ -1,8 +1,6 @@
if( [System.Environment]::OSVersion.Version.Build -lt 20000 ) {
# Windows 10
- reg.exe load 'HKU\DefaultUser' 'C:\Users\Default\NTUSER.DAT';
Set-ItemProperty -LiteralPath 'Registry::HKU\DefaultUser\Software\Microsoft\Windows\CurrentVersion\Explorer' -Name 'EnableAutoTray' -Type 'DWord' -Value 0 -Force;
- reg.exe unload 'HKU\DefaultUser';
} else {
# Windows 11
Register-ScheduledTask -TaskName 'ShowAllTrayIcons' -Xml $(
diff --git a/resource/TurnOffSystemSounds.ps1 b/resource/TurnOffSystemSounds.ps1
index f9cdbac..a74e3b3 100644
--- a/resource/TurnOffSystemSounds.ps1
+++ b/resource/TurnOffSystemSounds.ps1
@@ -1,6 +1,6 @@
-$excludes = Get-ChildItem -LiteralPath "Registry::${mountKey}\AppEvents\EventLabels" |
+$excludes = Get-ChildItem -LiteralPath 'Registry::HKU\DefaultUser\AppEvents\EventLabels' |
Where-Object -FilterScript { ($_ | Get-ItemProperty).ExcludeFromCPL -eq 1; } |
Select-Object -ExpandProperty 'PSChildName';
-Get-ChildItem -Path "Registry::${mountKey}\AppEvents\Schemes\Apps\*\*" |
+Get-ChildItem -Path 'Registry::HKU\DefaultUser\AppEvents\Schemes\Apps\*\*' |
Where-Object -Property 'PSChildName' -NotIn $excludes |
- Get-ChildItem -Include '.Current' | Set-ItemProperty -Name '(default)' -Value '';
\ No newline at end of file
+ Get-ChildItem -Include '.Current' | Set-ItemProperty -Name '(Default)' -Value '';
\ No newline at end of file