Skip to main content

Windows: Local Reinstall

private async Task PerformLocalReinstall(ResetOptions options)

public void ConfigureLocalReset() // Enable local recovery options in registry using (RegistryKey key = Registry.LocalMachine.OpenSubKey( @"SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System", true)) key?.SetValue("EnableLocalRecovery", 1, RegistryValueKind.DWord); key?.SetValue("AllowResetWithoutMedia", 1, RegistryValueKind.DWord); // Set custom recovery partition if needed using (RegistryKey key = Registry.LocalMachine.OpenSubKey( @"SYSTEM\Setup\Recovery", true)) key?.SetValue("LocalRecoveryPath", @"C:\Recovery\WindowsRE", RegistryValueKind.String); local reinstall windows

// Implement async directory copy await Task.Run(() => foreach (string file in Directory.GetFiles(source, "*", SearchOption.AllDirectories)) string destFile = file.Replace(source, destination); Directory.CreateDirectory(Path.GetDirectoryName(destFile)); File.Copy(file, destFile, true); ); foreach (string file in Directory.GetFiles(source