{"record":{"id":"0e33543551c77939","repo":"babalae/better-genshin-impact","slug":"windows-com","errorCode":null,"errorMessage":"当前 Windows 未提供任务计划程序 COM 服务。","messagePattern":"当前 Windows 未提供任务计划程序 COM 服务。","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"BetterGenshinImpact/Service/ChildSession/ChildSessionProcessLauncher.cs","lineNumber":103,"sourceCode":"    }\n\n    private static void LaunchWithTemporaryTask(\n        uint childSessionId,\n        string executablePath,\n        string arguments,\n        string workingDirectory)\n    {\n        var actualChildSessionId = ChildSessionNativeMethods.TryGetChildSessionId();\n        if (actualChildSessionId != childSessionId)\n        {\n            throw new InvalidOperationException(\n                $\"目标 Child Session 已发生变化。请求会话为 {childSessionId}，当前会话为 \"\n                + (actualChildSessionId?.ToString(CultureInfo.InvariantCulture) ?? \"无\")\n                + \"。\");\n        }\n\n        var schedulerType = Type.GetTypeFromProgID(\"Schedule.Service\")\n            ?? throw new InvalidOperationException(\"当前 Windows 未提供任务计划程序 COM 服务。\");\n        var taskName = $\"BetterGI-ChildSession-ElevatedLaunch-{Guid.NewGuid():N}\";\n        string accountName;\n        using (var currentIdentity = WindowsIdentity.GetCurrent())\n        {\n            accountName = currentIdentity.Name;\n        }\n\n        object? schedulerObject = null;\n        object? rootFolderObject = null;\n        object? taskDefinitionObject = null;\n        object? actionObject = null;\n        object? registeredTaskObject = null;\n        object? runningTaskObject = null;\n        var taskRegistered = false;\n\n        try\n        {\n            schedulerObject = Activator.CreateInstance(schedulerType)","sourceCodeStart":85,"sourceCodeEnd":121,"githubUrl":"https://github.com/babalae/better-genshin-impact/blob/a7cb36712dcb409be610257d877fcea3597e9d6b/BetterGenshinImpact/Service/ChildSession/ChildSessionProcessLauncher.cs#L85-L121","documentation":"Thrown when Type.GetTypeFromProgID(\"Schedule.Service\") returns null — the Task Scheduler COM automation object is not registered or not available on this Windows installation. The Child Session elevated-launch path relies on Task Scheduler to start a process in a specific session with high privileges.","triggerScenarios":"Running BetterGI on a Windows edition where the Task Scheduler service is disabled, removed, or its COM registration is missing (Server Core, locked-down LTSC, Group Policy disabling the Schedule service, or a broken COM registry).","commonSituations":"Windows Server Core without Desktop Experience; enterprise Group Policy that disables the Task Scheduler service; a Windows image stripped by a debloat tool that removed schtasks/COM registration.","solutions":["Run BetterGI on a full desktop Windows edition (Home/Pro/Enterprise) where the Task Scheduler service is present and running.","Enable the Task Scheduler service: set its startup type to Automatic and start it via services.msc or `sc config Schedule start= auto`.","If a debloat tool removed the COM registration, repair Windows or re-register the Task Scheduler COM components.","Note that Child Session elevated launch is not supported on Server Core by design."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Probe for Task Scheduler availability before attempting an elevated launch.\nif (Type.GetTypeFromProgID(\"Schedule.Service\") is null)\n{\n    throw new InvalidOperationException(\"当前 Windows 未提供任务计划程序 COM 服务。\");\n}","typeGuard":null,"tryCatchPattern":"try\n{\n    await ChildSessionProcessLauncher.LaunchElevatedAsync(childSessionId, exePath);\n}\ncatch (InvalidOperationException ex) when (ex.Message.Contains(\"任务计划程序\"))\n{\n    // Inform the user the OS edition does not support Child Session elevated launch.\n    logger.LogError(ex, \"Task Scheduler COM unavailable\");\n}","preventionTips":["Run BetterGI on a full desktop Windows edition with the Task Scheduler service enabled.","Surface a clear UI message when the COM ProgID is missing rather than letting the launch fail opaquely.","In enterprise environments, confirm Group Policy has not disabled the Schedule service."],"tags":["windows","com","task-scheduler","environment","child-session"],"backgroundTag":null,"analyzedSha":"a7cb36712dcb409be610257d877fcea3597e9d6b","analyzedAt":"2026-08-13T16:44:57.548Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}