Console App to enable ReagenctC recovery

Karthik RANGARAJ 0 Reputation points
2023-12-06T10:02:30.6766667+00:00

Hi All:

from the below console app code to enable the recovery, i get error message when i launch the app: Unable to boot the computer data

I'm trying to achive verify the recovery info status then enable it if its disabled.

could you please tell me how to fix this? thanks

I added the below information in the app manifest file:

	  <requestedExecutionLevel level="highestAvailable" uiAccess="false" />

code:

using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace EnableRecovery
{
    class Program
    {
        static void Main(string[] args)
        {
            var proc = new Process
            {
                StartInfo = new ProcessStartInfo
                {
                    FileName = "C:\\Windows\\System32\\ReAgentc.exe",
                    Arguments = "/info",
                    UseShellExecute = false,
                    RedirectStandardOutput = true,
                    CreateNoWindow = true
                }
            };
            proc.Start();
            while (!proc.StandardOutput.EndOfStream)
            {
                string line = proc.StandardOutput.ReadLine();
                // do something with line
                if (line.Contains("Windows RE status"))
                {
                    if (line.Contains("Disabled"))
                    {
                        Process newp = new Process
                        {
                            StartInfo = new ProcessStartInfo
                            {
                                FileName = "C:\\Windows\\System32\\ReAgentc.exe",
                                Arguments = "/enable",
                                UseShellExecute = false,
                                RedirectStandardOutput = true,
                                CreateNoWindow = false
                            }
                        };
                        newp.Start();


                    }
                }

            }
            Console.ReadKey();
            
        }
    }
}	
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,603 questions
{count} votes