fix(welcome): redirect WebView2 data dir off Program Files + launch wizard elevated via scheduled task
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -112,11 +112,22 @@
|
||||
<Username>sm-bootstrap</Username>
|
||||
<Password><Value>bootstrap-OneTime!</Value><PlainText>true</PlainText></Password>
|
||||
</AutoLogon>
|
||||
<!--
|
||||
FirstLogonCommands: launch the Welcome wizard ELEVATED (full admin token) without
|
||||
a UAC prompt by registering it as a scheduled task with /RL HIGHEST /IT, then
|
||||
triggering it immediately. The sm-bootstrap account is torn down by ApplyService
|
||||
on wizard completion.
|
||||
-->
|
||||
<FirstLogonCommands>
|
||||
<SynchronousCommand wcm:action="add" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State">
|
||||
<Order>1</Order>
|
||||
<CommandLine>cmd /c "C:\Program Files\SilverOS\Welcome\SilverOS.Welcome.App.exe"</CommandLine>
|
||||
<Description>SilverOS Welcome</Description>
|
||||
<CommandLine>cmd /c schtasks /Create /TN "SilverOSWelcome" /TR ""C:\Program Files\SilverOS\Welcome\SilverOS.Welcome.App.exe"" /SC ONCE /ST 23:59 /RL HIGHEST /IT /F</CommandLine>
|
||||
<Description>Register SilverOS Welcome as an elevated interactive scheduled task</Description>
|
||||
</SynchronousCommand>
|
||||
<SynchronousCommand wcm:action="add" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State">
|
||||
<Order>2</Order>
|
||||
<CommandLine>cmd /c schtasks /Run /TN "SilverOSWelcome"</CommandLine>
|
||||
<Description>Run the SilverOS Welcome wizard elevated in the active session</Description>
|
||||
</SynchronousCommand>
|
||||
</FirstLogonCommands>
|
||||
<RegisteredOwner>SilverMetal</RegisteredOwner>
|
||||
|
||||
@@ -9,6 +9,13 @@ public static class MauiProgram
|
||||
{
|
||||
public static MauiApp CreateMauiApp()
|
||||
{
|
||||
// Redirect WebView2 user-data folder off Program Files (not writable at runtime)
|
||||
// to a per-user writable path so the embedded browser can always create its data dir.
|
||||
var wv2 = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData),
|
||||
"SilverOS", "Welcome", "WebView2");
|
||||
Directory.CreateDirectory(wv2);
|
||||
Environment.SetEnvironmentVariable("WEBVIEW2_USER_DATA_FOLDER", wv2);
|
||||
|
||||
var builder = MauiApp.CreateBuilder();
|
||||
builder
|
||||
.UseMauiApp<App>()
|
||||
|
||||
Reference in New Issue
Block a user